-
Notifications
You must be signed in to change notification settings - Fork 71
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
Implement Feature Request: Add custom fields to define index and error documents #20
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,10 +22,15 @@ custom: | |
client: | ||
bucketName: unique-s3-bucketname-for-your-website-files | ||
distributionFolder: client/dist # (Optional) The location of your website. This defaults to client/dist | ||
indexDocument: index.html # (Optional) The location of your index document. Defaults to index.html | ||
errorDocument: error.html # (Optional) The location of your error document. Defaults to error.html | ||
spa: false # (Optional) Set this for single-page applications to redirect all errors to the index document | ||
``` | ||
|
||
* **Warning:** The plugin will overwrite any data you have in the bucket name you set above if it already exists. | ||
|
||
* **Warning:** If the 'spa' option is set, the errorDocument setting will be ignored. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If See my above comment on related to the |
||
|
||
|
||
**Third**, Create a website folder in the root directory of your Serverless project. This is where your distribution-ready website should live. By default the plugin expects the files to live in a folder called `client/dist`. But this is configurable with the `distributionFolder` option (see the example yaml configuration above). | ||
|
||
|
@@ -76,5 +81,6 @@ serverless client remove | |
- [amsross](https://github.com/amsross) | ||
- [pradel](https://github.com/pradel) | ||
- [daguix](https://github.com/daguix) | ||
- [evanseeds](https://github.com/evanseeds) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for saving me the work 😉 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I try to be thorough 😅 |
||
|
||
Forked from the [**serverless-client-s3**](https://github.com/serverless/serverless-client-s3/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@evanseeds Is there a benefit to adding this extra configuration value over just letting the user set both the index and error document to index.html?
It seems like it's an extra config value? Here's what I mean:
This:
Is the same expected outcome as this:
Any objection to removing the spa option? I'm open to it with valid use-case. I might just not understand it presently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My use case is using finch to deploy single-page applications that need all traffic redirected to index.html. This allows the webapp in the index.html file to handle all routes. I think it's more intuitive to be able to just set a 'spa' flag to true. Otherwise, a user would be to have to figure out how to implement this feature in S3, and then how to translate those S3 settings into finch.
In most of these cases you would be using the default 'index.html' indexDocument, and so the config comparison would be:
vs
The specific changes being made are more obvious in the second, but I think having the first option is more user-friendly.
'spa' may not be the best name, for sure. 'singlePage' or 'singlePageApplication' would be clearer names. Alternative, a more descriptive name like 'redirectErrorsToIndex' may work too.
Ultimately, there's a part of me that just doesn't like having to write the same thing twice, but maybe that's just an obsession 😅