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

deploy: Add stripIndexHtml target option #12608

Merged
merged 1 commit into from
Jun 20, 2024
Merged

deploy: Add stripIndexHtml target option #12608

merged 1 commit into from
Jun 20, 2024

Conversation

depp
Copy link
Contributor

@depp depp commented Jun 18, 2024

This new configuration parameter causes paths matching "

/index.html" to be stored as "/" remotely. This simplifies the cloud configuration needed for some use cases, such as CloudFront distributions with S3 bucket origins. Before this change, users must configure their S3 buckets as public websites (which is incompatible with certain authentication / authorization schemes), or users must add a CloudFormation function to add index.html to the end of incoming requests. After this change, users can simply use an ordinary CloudFront distribution (no additional code) with an ordinary S3 bucket origin (and not an S3 website).

This adds tests to ensure that functionality like matchers is unaffected by this change. I have also tested that the functionality works as expected when deploying to a real S3 / CloudFront website.

Closes #12607

This new configuration parameter causes paths matching
"<dir>/index.html" to be stored as "<dir>/" remotely. This simplifies
the cloud configuration needed for some use cases, such as CloudFront
distributions with S3 bucket origins. Before this change, users must
configure their S3 buckets as public websites (which is incompatible
with certain authentication / authorization schemes), or users must add
a CloudFormation function to add index.html to the end of incoming
requests. After this change, users can simply use an ordinary CloudFront
distribution (no additional code) with an ordinary S3 bucket origin (and
not an S3 website).

This adds tests to ensure that functionality like matchers is unaffected
by this change. I have also tested that the functionality works as
expected when deploying to a real S3 / CloudFront website.

Closes gohugoio#12607
@CLAassistant
Copy link

CLAassistant commented Jun 18, 2024

CLA assistant check
All committers have signed the CLA.

@bep
Copy link
Member

bep commented Jun 20, 2024

Thanks for this, I'm just adding some notes from what I needed to do on one my web sites (to update the documentation later...):

Amazon S3 > Buckets > [Bucket] > Properties > Static website hosting:

image

Cloudflare > Distributions > [ID] > Origins

Edit the origin and select the "non static website" S3 domain:

image

For proper 404 error pages:

CloudFront > Distributions > [ID] > Edit error page response:

image

@bep bep merged commit d5542ed into gohugoio:master Jun 20, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve integration with cloud static website hosting
3 participants