You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Godot version is probably irrelevant, as the script should setup a local HTTPServer independantly from a Godot editor or exported project.
System information
(irrelevant but) Godot v4.2.1.stable - Windows 10.0.19045
Issue description
When running the script (like this : python .\serve.py --root .), the local HTTP server starts, then my browser automatically starts and opens the URL "http://127.0.0.1:8060". But my browser gets an ERR_CONNECTION_REFUSED.
However, the files are accessible with those URLs : "http://localhost:8060/" or "http://[::1]:8060/"
It is consistent with the command logs : "Serving HTTP on :: port 8060 (http://[::]:8060/) ..."
A potential solution
Other people are editing the URL in the script to make it work in browser : #76631
I am not experienced enough with Python and the http.server module, but maybe the module is only using the IPv6 loopback address ? As a solution, should we put localhost instead of 127.0.0.1 in the script ?
Run it anywhere with "python .\serve.py --root ." (preferably in the folder of a Web exported Godot 4 project, if you want to test it with an actual project)
Expected behaviour :
The browser properly gets the directory listing at the root folder "." from the local HTTP server.
Actual behaviour :
The browser displays an "This site can't be reached" with an ERR_CONNECTION_REFUSED
So, it appears this is some Windows-specific regression introduced in python 3.8 , which was fixed in later version ( python/cpython#17851 ) but will still probably affect us for the way we use the http.server module.
I think we probably do the same and use the DualStackServer class instead of the base HTTPServer class. Edit: Nevermind, that's an internal class, but we can extend HTTPServer and call setsockopt ourselves.
@midiphony I've opened #90698 can you confirm it solves the issue for you?
Note that the first load may still result in an error, just refresh the page once in case, and it should work if the fix is correct (see #84439 / #90352 for more info on the first-load error).
Tested versions
System information
(irrelevant but) Godot v4.2.1.stable - Windows 10.0.19045
Issue description
When running the script (like this :
python .\serve.py --root .
), the local HTTP server starts, then my browser automatically starts and opens the URL "http://127.0.0.1:8060". But my browser gets anERR_CONNECTION_REFUSED
.However, the files are accessible with those URLs : "http://localhost:8060/" or "http://[::1]:8060/"
It is consistent with the command logs : "Serving HTTP on :: port 8060 (http://[::]:8060/) ..."
A potential solution
Other people are editing the URL in the script to make it work in browser : #76631
I am not experienced enough with Python and the http.server module, but maybe the module is only using the IPv6 loopback address ? As a solution, should we put
localhost
instead of127.0.0.1
in the script ?For context
The serve.py Python script file is a script intended to test the web editor, but it can also be used to test exported projects. It's a convenient script, as it is setting the CORS Headers needed to run a Godot 4 project on a client. The Godot documentation itself encourages to use it : https://docs.godotengine.org/en/stable/tutorials/export/exporting_for_web.html#serving-the-files:~:text=The%20Godot%20repository%20includes%20a%20Python%20script%20to%20host%20a%20local%20web%20server.
er.er.
Steps to reproduce
Expected behaviour :
Actual behaviour :
Workaround :
Minimal reproduction project (MRP)
Just test the Python script at https://github.com/godotengine/godot/blob/master/platform/web/serve.py
The text was updated successfully, but these errors were encountered: