Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

620
Visualizações
NextJS websocket proxy(?) to server through docker DNS

I have an app of NextJS frontend server and a backend server(irrelevant in this question), each defined and deployed as docker-compose service.

Since the hostname of the backend server is dynamic by docker DNS, I would have to refer to it by its service name on NextJS server, which resolves it on runtime. I use NextJS's _middleware.ts, which is essentially a convenient way to define a generic API Route as far as I can tell.

This works well for HTTP requests, but for the WebSocket request that initiates the handshake, the WebSocket class expects ws://*** format for the URL argument, which does not go through the NextJS's API Route obviously since it doesn't start with /api.

So it's looking like I:

  • have to somehow resolve the DNS hostname
  • have to use ws:// format

, and it seems these can't be achieved at the same time for NextJS. Am I missing something?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda