-
Notifications
You must be signed in to change notification settings - Fork 106
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
Static websites fail to rewrite URL for sub directories #192
Comments
Are you sure that https://some-website/sub-directory used to work? To my knowledge this wasn't supported: you had to use https://some-website/sub-directory/ URLs, but I may be wrong 🤔 @adriencaccia does that ring a bell? |
@mnapoli I can confirm that in version 1.12.1 this is working. The main difference: In 1.12.1 we have:
In 1.14.0:
The solution for 1.14 is to either re-enable static website hosting or to add a lambda for the request event with: function handler(event) {
var request = event.request;
var uri = request.uri;
// Check whether the URI is missing a file name.
if (uri.endsWith('/')) {
request.uri += 'index.html';
}
// Check whether the URI is missing a file extension.
else if (!uri.includes('.')) {
request.uri += '/index.html';
}
return request;
} I will test this manually and let you know if both or one of the solutions do really work. But I can confirm that when I deploy my app with version 1.14.0 my app is broken. |
Right, 1.12.1 introduced support for I still think That being said, I'm not against switching |
You are correct, the
I played around a bit and there is something very strange that I can't explain at the moment. When I deploy my app with version 1.12.1, I can see my web page when calling an url with However, when I deploy with 1.14.0, and I manually reconfigure everything exactly the way it is done with 1.12.1, it still refuses to show the page with So I really don't understand what is still different underlying. |
Description
I think that since the changes from #175 there is BC break introduced for the 'static-website' type deploy. When deploy a static website that has an
index.html
in a sub directory , that file will not be loaded automatically anymore. To view to page you have to explicitly provide the index.html in the url.❌ - https://some-website/sub-directory
✅ - https://some-website/sub-directory/index.html
From what I could see, is that previously the static-website was deployed with the S3 static website feature. Now it doesn't causing it to fail.
How to Reproduce
Deploy a static website with some sub directories and an index.html page in it and deploy like a static website
If you then open the url with the subdirectory you will get following error:
Additional Information
Additionally, the problem is well explained here and with a possible solution.
The text was updated successfully, but these errors were encountered: