Skip to content
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

Aliased directories and requests to / should return /index.html #43

Closed
zachleat opened this issue Jan 11, 2023 · 2 comments
Closed

Aliased directories and requests to / should return /index.html #43

zachleat opened this issue Jan 11, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@zachleat
Copy link
Member

I figured it out – if the directory that is the target of a passthrough copy has subdirectories, the files do get served if you go to them directly, e.g. the URL http://localhost:8080/mobile-wiki/index.html will serve the index.html file. But the URLs http://localhost:8080/mobile-wiki and http://localhost:8080/mobile-wiki/ will not serve the index.html file if the passthrough copy behavior is "passthrough". Not sure if that qualifies as a bug, but definitely had me chasing this down for a while.

Edit: Just noticed that this behavior can be reproduced in a simpler setting: 1. Make a passthrough rule that copies a directory, e.g. dir, over, and 2. make sure it has an index.html file inside it. Then if the copy behavior is "passthrough", visiting dir/ will 404 while visiting dir/index.html will not, but if copy behavior is "copy" then both will work.

11ty/eleventy#2739 (comment)

cc @yurivish

@zachleat zachleat added the bug Something isn't working label Jan 11, 2023
@yurivish
Copy link

yurivish commented Jan 13, 2023

Thanks for filing this!

I also noticed that some other URLs to static passthrough copies don't resolve – e.g. on the site I was working on, http://localhost:8080/cardcrafting/img_2x/2015-08-17%2014.19.27.jpg is a 404 even though the file exists. I think it's probably the space between the date and time, encoded as %20.

I get an error ("Cannot GET /cardcrafting/img_2x/2015-08-17%2014.19.27.jpg") with the dev server by default, but can get the image to load by putting the following ine in my config:

eleventyConfig.setServerPassthroughCopyBehavior("copy");

@zachleat
Copy link
Member Author

zachleat commented Jun 4, 2024

I believe the second issue @yurivish is tracked at #59. The first issue seems to be resolved with Dev Server 2.0.0.

@zachleat zachleat added this to the Eleventy Dev Server v2.0.0 milestone Jun 4, 2024
@zachleat zachleat closed this as completed Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants