preact-cli icon indicating copy to clipboard operation
preact-cli copied to clipboard

Webpack-Dev-Server uses the port of the dev server regardless of where the content was served from

Open rschristian opened this issue 3 years ago • 4 comments

Do you want to request a feature or report a bug?

Bug

What is the current behaviour?

Currently Webpack-Dev-Server will not necessarily use the correct port when making requests to the dev server. It will instead assume the port that the dev server is running upon.

This becomes a problem when used with items like Ngrok. Ngrok offers a way to create HTTP tunnels. You can make localhost:3000 accessible to the world via https://public.url.

The issue is that, while all content can be correctly served and the site usable, Dev Server will attempt to communicate with https://public.url:<dev server port number>. It needs to instead use the port number from the current address.

Probably a simple case of ensuring the plugin doesn't assume a port.

Not yet familiar enough with Prefresh to say whether it's an issue for this repo or its, so leaving this here while I investigate.

What is the expected behaviour?

That the request from the Dev Server goes to the correct address

rschristian avatar Feb 06 '21 09:02 rschristian

I don't think that is an issue with prefresh as much as it is an issue with how the web-dev-server/hot-plugin is injected, a different port should be reflected on that I'd think.

JoviDeCroock avatar Feb 06 '21 09:02 JoviDeCroock

Fair enough, I currently know probably next to nothing about what Prefresh is actually doing, so I just took a guess before investigating further. Certainly will look at those then.

rschristian avatar Feb 06 '21 09:02 rschristian

I guess a good entry point would be to check whether or not normal hot-mode works i.e. if signals reach the client and if normal preact dev full reload mode works

JoviDeCroock avatar Feb 06 '21 10:02 JoviDeCroock

This looks to be a famously challenging problem (now that I've been pointed in the right direction, sorry Prefresh!), so a solution probably isn't going to be pleasant, just in case anyone else runs into this.

rschristian avatar Feb 07 '21 03:02 rschristian