Built-In Webserver Stopped Working?
Answered
[Mac Sierra, latest version of Ultimate]
After a few years of trouble-free operation, the built-in web server seems to no longer function properly. I am literally only trying to load an html page.
In testing, even a simple index.html file never finishes loading ("Waiting for localhost..."). Inspecting the web page source in the browser, I can see the page is downloading partially.
I have tried the following:
- completely uninstalled and reinstalled IntelliJ
- tried running with virtually everything disabled (including OS X firewall)
- checked port 63342 for conflicts
At a complete loss - any ideas?
Please sign in to leave a comment.
Please check if the issue is specific to IntelliJ IDEA. Exit the IDE. In the project directory run this:
python -m SimpleHTTPServer 63342
Try accessing the page in the browser. Does it show the same problem as in IntelliJ IDEA?
It's just with IntelliJ - however I've noticed one thing that wasn't happening before:
Looks like there's an issue with authorization (maybe the token?)
Any resources loaded in the HTML of an index.html file (e.g., images, css, etc) will (if I wait a minute or two) result in one of the warnings in the image above.
Any ideas?
Does it help if you enable this option?
Just tried it an no - so it appears that anything after the first request the first time I use the server hangs on authorization.
In other words, if I launch the IDE and open index.html in chrome, index.html loads, but no subsequent resources. Once that first request was made in the open IDE, no subsequent requests are served.
I have to quit the IDE and restart to again load the first file requested.
Did you restart IntelliJ IDEA?
Could you please share a sample project to reproduce it?
Restarted, reinstalled -
This hasn't worked for about a month and I decided to focus on it a bit tonight - and suddenly it's working again from within the IDE (simplehttpserver always worked from the terminal outside the IDE).
Unfortunately I'm not sure which of the 500 things I tried tonight did it - I did just deleted a OS X firewall rule to allow incoming connections to IntelliJ (because I wasn't sure when or why I gave that permission) but I can't imagine why that would have fixed it...
I'll come back and post again if it stops working again. I sure do appreciate your suggestions -
Same issue. Built in web server stopped working. Right click on a scratch_xx.html and select Open in Chrome. Used to launch in the web server now it just serves it up as a file -- I'm doing some stuff requiring CORS since this is served from the file system instead of from a server CORS is really upset about it.
I was hoping that the solution would be posted here. But the OP suddenly stopped having the issue. Any help is appreciated.
I tried: `localhost:63342/my_project/scratch_xx.html` and this didn't work either.
Please report a bug at https://youtrack.jetbrains.com/issues/WEB and provide the exact steps to reproduce this behavior so that we can address it.
Same problem. I've been working on an interactive website in IntelliJ for about 5 months now. Clicking the Chrome icon in the editor always opened the HTML file at http://localhost:63342/. Suddenly for no reason at all, it stopped doing this a few nights ago. Ever since, it opens the file in the browser using it's file path on the disk. This is extremely frustrating.
JetBrains, you really need to get this fixed. I've wasted hours of dev time tonight scouring the Internet looking for a solution, and no one seems to know what causes it or how to fix it. The last post in this thread was in 2017. It's 2023 and people are still having this problem. GET THIS FIXED!
People have been reporting this bug for years.
Art
Anything changed in your network settings lately? Can you check the hosts file for possible localhost redirection?
It if it is not the case, please submit a new bug report, provide a demo project and exact steps to reproducing the problem so that we can address it.
I was wondering why I received email about this until I changed my profile alias... Arina Efremova I think you linked the wrong Art.
Arina Efremova
Nothing has changed on my network. I installed the latest version of IntelliJ, reset settings to default, etc. I created a new project with an HTML file, and this one works - it opens on localhost. However, both my test project and the official project directories reside in IdeaProjects, so I don't know why IntelliJ can find the new test, but not my existing project files.
Since installing the new version, clicking the browser icon will open on localhost, but I get a 404 Error - Page not found.
I have been back and forth with Ethan Yin via email for the past four days now. Nothing he's suggested has made any difference. IntelliJ seems to be ignoring this project specifically for some reason, despite it working normally a couple of weeks ago...?
Art
As I can see, the last suggestion did actually help:
So the issue seems to be project-specific after all. If you would like us to get to the bottom of this, please provide the project in question (or a stripped down demo version of it) in the initial conversation with Ethan and Serge. You can upload it privately to https://uploads.jetbrains.com and share the upload id.
Thanks for the suggestion that it was project specific. I tried deleting my .idea folder (after backing up) and it seemed to fix my issue.
Project settings can be recreated :)