-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
Serve HTML from extensionless URLs in http.server #100463
Comments
This should be discussed on https://discuss.python.org/c/ideas/6. I wouldn't support this feature, because http.server isn't meant to be used as a production web server, and I'm concerned about any possible security implications of this. |
Fair enough concerns. My thinking is that this would mainly be used for local development before being deployed to a proper webserver for actual use. I'll open a discussion on the discourse and go into more detail about my rational there. |
IMO, if http.server supports serving index.html when found in a directory that matches the URL, then it’s good enough. |
I've opened a discussion on discuss.python.org. At the very least this issue led to me finding a bug. (#100474) |
The generally consensus from this discussion is that this is something that is better handled in user code by subclassing the server. As such I'm going to close this issue. |
Feature or enhancement
Add handling for extensionless URLs in http.server
For example if you have a folder containing
foo.html
and runpython3 -m http.server
from it, you would be able to use the URLhttp://localhost:8000/foo
rather than having to usehttp://localhost:8000/foo.html
.Pitch
A common pattern in URL design is to omit the file extension for pages, as this
both makes the URL look nicer and makes it technology agnostic (it doesn't
matter if the page is written in PHP or HTML).
The motivation for this change is the common use case of the python HTTP server
for static website development, especially amongst those learning HTML/CSS.
This change allows them to use the best practice of omitting extensions in
links and still having navigation between multiple pages working.
Previous discussion
Needs to have one on https://discuss.python.org/c/ideas/6.
Linked PRs
The text was updated successfully, but these errors were encountered: