Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override websocket location #236

Closed
mikecardwell opened this issue Nov 9, 2016 · 4 comments
Closed

Override websocket location #236

mikecardwell opened this issue Nov 9, 2016 · 4 comments

Comments

@mikecardwell
Copy link

I have an nginx server. It has a https vhost. We'll pretend it is https://www.example.com for now. I have told it to proxy to a next.js application running at localhost:3000. The trouble is, my browser is trying to open a websocket to "https://localhost:3030". I don't see a way of overriding where the websocket connection should go to... Ideally, I'd just tell it to go to https://www.example.com and then configure nginx to forward requests for /sockjs-node/ to localhost:3030.

So, is there a way of overriding the websocket location? If not, can I add this as a feature request please.

@nkzawa
Copy link
Contributor

nkzawa commented Nov 14, 2016

Unfortunately, you can't customize it. It should be supported.

@coffenbacher
Copy link

coffenbacher commented Nov 15, 2016

Similarly, I develop on a remote machine so localhost doesn't work for me. If anyone else has that challenge, for now, I was successfully able to use Fiddler HOSTS feature to remap localhost -> remote IP. I'm sure there's a similar debugging proxy for OS X / Linux (Charles?) that could do the same.

(Edit: in case anyone else was going to try, I found out Chrome WebRequest handlers don't fire for websockets so a browser extension is out)

@mingfang
Copy link

This is a show stopper for me.

@mikecardwell
Copy link
Author

FWIW, as a temporary workaround I am running the following command to modify the hard coded websocket to my own domain. In the below example I'm changing it to the SSL secured "example.com":

grep -r http://localhost:3030 .next node_modules/next|awk -F ':' {'print $1'}|sort -u|xargs perl -pi -e 's,http://localhost:3030,https://www.example.com,g'

@lock lock bot locked as resolved and limited conversation to collaborators May 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants