-
Notifications
You must be signed in to change notification settings - Fork 162
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
add /index.html when uri ending with a word that doesn't contains a dot #226
base: master
Are you sure you want to change the base?
Conversation
… ending with a word that doesn't contains a dot
PR very much appreciated! Question, how "right" is this in general? It might be specific to your use case. Perhaps we should put it under another parameter eg |
I think my approach is right because of, in my experience, is quite common get the same result for urls like http://example.com/path and http://example.com/path/ (for example, https://github.com/s-nt-s/ and https://github.com/s-nt-s give same result). But maybe is better, as you said, use a new parameter like Thanks. |
Let's get some data points. Just asked a colleague's opinion and he thinks otherwise. How do eg other static site hosters do this (Apache, Next.js, etc) ? |
I check apache and nginx using docker:
So by default Apache and nginx redirect Other examples/server:
So also serve same page for |
Thanks for the research. That's pretty convincing. Still a doubt, what if you want to host a file without an extension. Let's say, as example, some Dockerfile, such as this one: https://github.com/nginxinc/docker-nginx/blob/5ce65c3efd395ee2d82d32670f233140e92dba99/mainline/alpine/Dockerfile Guess you could upload that to S3 as Can we invent a solution that works in all cases? I'm playing with the thought of returning a 307 redirect to |
Tweak to that thought: return a 307 redirect to What do you think? |
Hi @s-nt-s , share your thoughts? |
Hi. Maybe I am wrong and this is not a big deal, but If Lambda@Edge have to check if the object exists or no in order to decide if return 307 or 404, it need permissions to read in s3 and spend a lite more time for do its job. (I don't know if a Lambda@Edge inherits permissions from its cloudfront so its have read permission over s3 origin transparently or no) I think that in most of case is not worthy. As you point in your first comment, probably is better add a RewritePathWithoutExtensionToIndex and let the developer configure as he wants. |
The Lambda@Edge origin response would see the response code 404 come back. That is part of the event payload, i.e. that function doesn't actually need to go to S3. It can be a synchronous function even. |
@s-nt-s Thank You for this. I needed something similar. Here is my fork with your changes rebased |
@ottokruse This is useful for us as well. What can we do to help get this merged? |
Sounds like the PR as is, is what you folks would all be happy with? When can go ahead with it. Will merge and release the new version to SAR this week somewhere when I have some spare time. |
Just to double check. Everyone here is fine with that blocking the possibility of hosting files without extension? I still feel uneasy about it |
Honestly I would prefer if this were hidden behind a boolean flag so that it could be enabled but would default to the current behavior. Unfortunately, (1) I have zero Node experience, and (2) I'm not even using 90% of this repo, I'm just using the Lambda code inside infrastructure managed via terraform. |
I've just stumbled on this PR while updating my fork. I have some work to do reviewing the PR and assembling references to the relevant standards, but I am generally against this being applied without deeper consideration. The |
Description of changes:
Whit this change, when
RewritePathWithTrailingSlashToIndex=true
, uris ending in a word that doesn't contains a dot (".") has the same behavior as a uri ending in a slash ("/).In others words,
http://example.com/path
andhttp://example.com/path/
are rewrite ashttp://example.com/path/index.html
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.