Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

619
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!