[BUG] `/example.com/` does not resolve to `/example.com/index.html` in development.
See original GitHub issueBug Report Quick Checklist
- I am on the latest version of Snowpack & all plugins.
- I use package manager 7.15.0
- I run Snowpack on macOS 10.15.7
- I run Snowpack on node v16.2.0
Describe the bug
localhost:8080/example.com/
does not resolve localhost:8080/example.com/index.html
in development. The presence of .com
in the folder seems to trigger a heuristic for file extensions:
[18:19:57] [snowpack] Error: /Users/lgarron/Code/git/github.com/lgarron/snowpack-url-folders/public/example.com/index.html - Requested content ".com" but only built .html
[18:19:57] [snowpack] [500] /example.com/
To Reproduce
https://github.com/lgarron/snowpack-url-folders has a repro with two folders that each contain a simple index.html
:
public/example/
public/example.com/
Repro steps:
git clone https://github.com/lgarron/snowpack-url-folders && cd snowpack-url-folders
npm install
npx snowpack dev
# This works
open http://localhost:8080/example/
# This doesn't work:
open http://localhost:8080/example.com/
Expected behavior
Whether a path resolves a folder to its index.html
does not depend on whether any containing folders contain a period.
Anything else?
This comes about in practice because we have source/demo code for multiple sites in the same project, and the folders for those demos contain the domains for those sites:
https://experiments.cubing.net/cubing.js/twizzle.net/ https://experiments.cubing.net/cubing.js/alg.cubing.net/
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:10 (6 by maintainers)
Top Results From Across the Web
reactjs - Respond always with index.html - Stack Overflow
html for all URLs and that's what my server responds with. However, first request is never example.com/index.html , it's for example example.com ...
Read more >Same-origin policy - Web security | MDN
The same-origin policy is a critical security mechanism that restricts how a document or script loaded by one origin can interact with a ......
Read more >HTTP: Hypertext Transfer Protocol (article) - Khan Academy
For example, the most well known status code is 404 ("File not found"). ... Next, type a URL in the browser bar, like...
Read more >Default Plesk web page or other incorrect web page is shown
To find the correct filename, contact the website developer. ... Log into Plesk; Go to Domains > example.com > File Manager ...
Read more >How to Change your Default Index Page in the htaccess file
First the server will check for first.html, if it does not find a file with that name, it continues to index.htm and so...
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 FreeTop 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
Top GitHub Comments
🥳😍
Thanks, that seems to work perfectly! My current work involves such a folder, and it’s delightful to see it load directly. 😊
Thanks! I just tried it out. 😄
Good news: This seems to serve the correct body content.
Sad news: The content is served with
application/octet-stream
, which prevents the page from being loaded in a browser and triggers a download instead. 😦