This issue was previously reported but the issue marked closed. I'm re-introducing it to hopefully bring it to your attention again. https://github.com/webpack/webpack-dev-server/issues/868
webpack-dev-server Version: 3.1.0
[x] This is a bug
https://github.com/mimshwright/wps-bug
When loading a page served by WebpackDevServer with https enabled in Safari, the page should load normally.
The page continuously reloads.
It appears the browser reloads as soon as the full content of the HTML is loaded. When I first discovered the bug in a rather substantial code-base, it was reloading every 3 or 4 seconds. However, when I run a barebones demo I see the page refresh several times per second and nothing ever gets drawn to the screen.
Load a page served by WebpackDevServer with HTTPS enabled over a local network in Mobile Safari.
I am experiencing the same issue on Safari mobile using the Safari of iOS simulator.
On desktop everything works fine in Safari and Chrome.
Were you able to solve it somehow?
Thanks!
I am running into the same issue. The log displays this error:
WebSocket network error: The operation couldn’t be completed. (OSStatus error -9807.)
close — client:170
As far as I can tell Safari does not accept the SSL certificate for the web socket connection. I have not found a workaround so far.
+1
+1
It's not at all an ideal solution but I was able to at least stop the constant reloading by setting inline: false.
+1
For what it's worth--if you don't mind using an SSL certificate that requires a little sysops setup on your part, you can use https://letsencrypt.org/ to get free certificates for your dev environment that are trusted by most systems.
If you don't mind using certificates where your private key may or may not be private, try https://zerossl.com/ , an online tool that uses Let's Encrypt as a backend to generate valid certificates for SSL.
Once I had a valid SSL Certificate coming out of my Webpack Dev Server, this bug went away on iOS Safari.
// ...
devServer: {
inline: true, // Yeah!
https: {
key: fs.readFileSync("< path to your private key >"),
cert: fs.readFileSync("< path to your valid certificate >"),
},
public: '< your domain name for your development environment>',
host: '< an ip address that works for you, maybe 0.0.0.0 >',
port: 443,
// and so on
},
// ...
I think webpack-dev-server is fine, here is how I made it work:
mkcert https://github.com/FiloSottile/mkcertmkcert --install
mkcert 192.168.86.42 localhost 127.0.0.1 0.0.0.0
--host 0.0.0.0 --cert=./<your.pem> --key=./<your pem key> --httpsProblem in Safari, we use node API for running server over https (https://github.com/webpack/webpack-dev-server/blob/master/lib/Server.js#L596). Looks this happens not only for webpack-dev-server https://stackoverflow.com/questions/18964175/how-to-fix-curl-60-ssl-certificate-invalid-certificate-chain. Some Safari version doesn't have good support for self-signed certificates and/or disable support self-signed certificates due security reasons. We can't solve this problem on our side. Feel free to experiment and feedback, also feel free to improve docs about this limitation.
Ref: https://www.osstatus.com/search/results?platform=all&framework=all&search=-9807
I ran into this issue as well, usually when going between different projects that use webpack-dev-server and https. What worked for me, albeit a somewhat excessive solution, was clearing the iOS Safari browser data (Settings → Safari → Clear History and Website Data).
Most helpful comment
I ran into this issue as well, usually when going between different projects that use
webpack-dev-serverandhttps. What worked for me, albeit a somewhat excessive solution, was clearing the iOS Safari browser data (Settings → Safari → Clear History and Website Data).