Support foo/index.html -> foo/ without stripping ".html" from other paths?
See original GitHub issueThe standard behavior I’m used to from a static file serving program is that foo.html
should be served as-is, but requests for foo/
should serve foo/index.html
if it exists, rather than a directory listing. The new cleanUrls=false
setting lets me prevent foo.html
from redirecting to foo
, but also loses the ability to serve foo/
.
Are these two things intentionally part of the same setting? I’m not sure how to get back to a traditional behavior here. Thanks!
cleanUrls=true
- foo/ (serves foo/index.html)
- foo.html -> redirect -> foo
cleanUrls=false
- foo/ (serves directory listing)
- foo.html (serves as-is)
I would prefer:
- foo/ (serves foo/index.html)
- foo.html (serves as-is)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:22
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to tell webpack dev server to serve index.html for any route
I found the easiest solution to include a small config: devServer: { port: 3000, historyApiFallback: { index: 'index.html' } }. I found this...
Read more >Support optional public base path configuration #8540 - GitHub
I'm facing one situation which is that, in index.html some resource references are provided by other microservices but in same origin, ...
Read more >Remove trailing slash and index.html in .htaccess
It is not exactly the answer to your question but you should think twice about removing trailing slashes for directories. The doc about...
Read more >Pitfalls and Common Mistakes | NGINX
namei -om /path/to/check ... location /foo { root /var/www/nginx-default/; # [. ... http { index index.php index.htm index.html; server { server_name ...
Read more >Template Designer Documentation - Jinja
if there is not, check for an attribute called bar on foo . ... For example, {{ name|striptags|title }} will remove all HTML...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
To phrase the issue a little more generally, I think the latest release has introduced some disconnect between the stated purpose of the package and its functionality:
This description (especially the first paragraph) makes
serve
sound like a general-purpose static file server that can be used for local development and more. However, if you’re using anything other than Now static deployments for the production site, there is no combination ofserve.json
settings that will give consistent paths in both environments. I use Zeit Now for various projects and like it a lot, but I don’t use it for everything and (with the current config options) will need to stop usingserve
with projects that deploy to GitHub Pages, for example.I realize consistency within the Zeit ecosystem is important, and it’s something I value about Zeit, so if this is all intended behavior I’ll certainly understand. But in that case I think the language in the readme describes this package as being more general-purpose than it is today.
yes, my plain html file is getting broken. /foo/index.html loads
./x.js
(which means/foo/x.js
) but serve rewrite it to/foo/
then/foo
and now my html breaks.