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

[Feature request] Allow specification of DefaultRootObject when creating/updating cloudfront distribution #57

Open
iamogbz opened this issue Jan 7, 2024 · 1 comment

Comments

@iamogbz
Copy link

iamogbz commented Jan 7, 2024

Specific use-case is deploying multiple versions of the app based on the the current git branch, as highlighted by the docs.

You can also specify a path: app.example.com/something. This can be useful to deploy multiple versions of an app in the same s3 bucket. For example one could deploy a feature branch of the SPA like this:

While it is possible to remove the branch name from app.example.com/<branch>, it would be helpful to allow configuring the default root object served when no branch path is given.

Example: Deploying and having the default release branch be main;

  • app.example.com -> main/index.html (default)
  • app.example.com/main -> main/index.html
  • app.example.com/next -> next/index.html
  • app.example.com/new-feature -> new-feature/index.html etc.

Open to putting up a PR for the changes needed

@iamogbz iamogbz changed the title [Feature request] Allow specification of DefaultRootObject when creating cloud front distribution [Feature request] Allow specification of DefaultRootObject when creating/updating cloudfront distribution Jan 7, 2024
@iamogbz
Copy link
Author

iamogbz commented Oct 31, 2024

Changes in new version breaks existing S3 configurations.

aws-spa/src/s3.ts

Lines 106 to 120 in 95ea829

export const setBucketWebsite = (bucketName: string) => {
logger.info(
`[S3] ✏️ Set bucket website with IndexDocument: "index.html" & ErrorDocument: "index.html" to "${bucketName}"...`
)
return s3.putBucketWebsite({
Bucket: bucketName,
WebsiteConfiguration: {
ErrorDocument: {
Key: 'index.html',
},
IndexDocument: {
Suffix: 'index.html',
},
},
})

If the user has a different default root configured this overwrites it.

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

No branches or pull requests

1 participant