Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

622
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda