Closed Nv7-GitHub closed 3 years ago
Hi, how are you configuring the SSL for WSS? If you're using an NGINX proxy, make sure that the redirection proxy is also set to redirect. Since it's working on your localhost, Fiber should not have any issue. Ikisocket it's just a wrapper on top of Fiber.
Keep me posted if you discover that is a bug in ikisocket. Thanks
Above is the Nginx config, is something wrong with it?
Seems to be fine. But if you copied my example, why the port is different on your proxypass?
In any case, if you said that it's working on your local machine, Ikisocket and Fiber should be both ok.
So the issue should be located somewhere else
After some digging, I've found this doc https://www.nginx.com/blog/websocket-nginx/ and some services want Upgrade and not upgrade as Connection Maybe this can help you.
I will leave this open another day, maybe you can solve the issue and you can write here the solution, so will be helpful also for others with the same issue
Are there any headers that aren't being passed through the Nginx proxy that could be causing IsWebsocketUpgrade to return false? Is there a way to see what headers fasthttp checks?
Via Fiber you can check all the headers inside that .Use()
Check here how to retrieve the headers https://docs.gofiber.io/api/ctx#get
I tried printing the Connection header, and for some reason it says "close". The nginx config sets the "Connection" header, so why would it be close
? It appears that close
is the default header, so is nginx not setting the header?
It seems that you have some issues between your proxy and your application server. If you try to connect directly bypassing the proxy, it works, right?
Yes, it works on localhost.
I understand that, but when you deploy it on a server, it works? I mean, instead of connecting to your domain (using NGINX), connecting directly to the IP of the server where the application is deployed (without proxy), it works? If you connect directly to 172.18.0.12:
I'll close this issue because seems to be a configuration issue more than a library issue
I copied the code from the example into my test server. It worked fine on localhost using https://www.websocket.org/echo.html, but when I deployed it and used
wss://api.nv7haven.tk/ws/123?v=1.0
, it is returning a 426. I put a print statement, and its returning a 426 because IsWebsocketUpgrade is returning false. Why is it returning false, and how can I fix this?