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

187
Views
How to proxy a websocket properly?

I'm having trouble proxies websocket using http-proxy-middleware. The error I got was Websocket connection to https://api.dsm-staging.test.site failed. Here's the code I'm using in express :

const { createProxyMiddleware } = require("http-proxy-middleware");

const options = {
  target: "https://api.dsm-staging.test.site",
  changeOrigin: true,
  ws: true,
};

const proxy = createProxyMiddleware(options);
app.use("/v1/*", proxy);

This is my code in front end :

this.socket = io("https://api.dsm-staging.app.test.site", {
        reconnectionAttempts: 5,
        reconnectionDelayMax: 10000,
        extraHeaders: {
          Authorization: `Bearer ${token}`,
        },
        transports: ["websocket"],
 });

 this.socket.on("connect", () => {
    console.log(this.socket.connected);
  });
about 4 years ago · Santiago Trujillo
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!