You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Object metadata options (#26)
* allow user to set http headers for hosted files
* clarify that metadata keys for folders must end in '/'
* change naming from objectMetadata -> objectHeaders
* applying new linting rules post-merge
* change to use headerName and headerValue
* Refactor (#43)
* split up code more logically, get bucket removal working
* finish up refactor
* more refactoring
* split out configure functions into separate file
* add object metadata functionality back in
* fix typo in README
* start log of changes for v2.0.0
* re-allow command-line region option, update log messages
* adding CLI params for disabling deleting and config/policy/cors updates (resolves#28 and resolves#15)
* add routing options in
* finish off validation for all configuration options
* update changelog again and add Linus as a maintainer
* comment out all tests for now -- will be rewritten
* add confirmation prompts on deploy and remove
* Fix validator bug (#44)
* fix bug in validator - throw instead of return
* fix README to reflect objectHeaders new naming
* remove line in jsdoc string - validateClient no longer returns anything
* collect all validation errors before throwing
The plugin should output the location of your newly deployed static site to the console.
52
52
53
+
**Note:***See [Command-line Parameters](#command-line-parameters) for details on command above*
54
+
53
55
**WARNING:** The plugin will overwrite any data you have in the bucket name you set above if it already exists.
54
56
55
57
If later on you want to take down the website you can use:
@@ -122,16 +124,187 @@ The name of your error document inside your `distributionFolder`. This is the fi
122
124
123
125
---
124
126
127
+
**objectHeaders**
128
+
129
+
_optional_, no default
130
+
131
+
```yaml
132
+
custom:
133
+
client:
134
+
...
135
+
objectHeaders:
136
+
ALL_OBJECTS:
137
+
- name: [header-name]
138
+
value: [header-value]
139
+
...
140
+
specific-directory/:
141
+
- name: [header-name]
142
+
value: [header-value]
143
+
...
144
+
specific-file.ext:
145
+
- name: [header-name]
146
+
value: [header-value]
147
+
...
148
+
... [more file- or folder-specific rules]
149
+
...
150
+
```
151
+
152
+
Use the `objectHeaders` option to set HTTP response headers be sent to clients requesting uploaded files from your website.
153
+
154
+
Headers may be specified globally for all files in the bucket by adding a `name`, `value` pair to the `ALL_OBJECTS` property of the `objectHeaders` option. They may also be specified for specific folders or files within your site by specifying properties with names like `specific-directory/` (trailing slash required to indicate folder) or `specific-file.ext`, where the folder and/or file paths are relative to `distributionFolder`.
155
+
156
+
Headers with more specificity will take precedence over more general ones. For instance, if 'Cache-Control' was set to 'max-age=100' in `ALL_OBJECTS` and to 'max-age=500' in `my/folder/`, the files in `my/folder/` would get a header of 'Cache-Control: max-age=500'.
157
+
158
+
---
159
+
160
+
**redirectAllRequestsTo**
161
+
162
+
_optional_, no default
163
+
164
+
```yaml
165
+
custom:
166
+
client:
167
+
...
168
+
redirectAllRequestsTo:
169
+
hostName: [hostName]
170
+
protocol: [http|https]
171
+
...
172
+
```
173
+
174
+
Use the `redirectAllRequestsTo` option if you want to route all traffic coming to your website to a different address. `hostName` is the address that requests should be redirected to (e.g. 'www.other-website.com'). `protocol` is the protocol to use for the redirect and must be either 'http' or 'https'.
The `routingRules` option can be used to define rules for when and how certain requests to your site should be redirected. Each rule in the `redirectRules` list consists of a (required) `redirect` definition and (optionally) a `condition` on which the redirect is applied.
203
+
204
+
The `redirect` property of each rule has five optional parameters:
205
+
206
+
* `hostName` is the name of the host that the request should be redirected to (e.g. 'www.other-site.com'). Defaults to the host from the original request.
207
+
* `httpRedirectCode` is the HTTP status code to use for the redirect (e.g. 301, 303, 308).
208
+
* `protocol` is the protocol to use for the redirect and must be 'http' or 'https'. Defaults to the protocol from the original request.
209
+
* `replaceKeyPrefixWith` specifies the string to replace the portion of the route specified in the `keyPrefixEquals` with in the redirect. For instance, if you want to redirect requests for pages starting with '/images' to pages starting with '/assets/images', you can specify `keyPrefixEquals` as '/images' and `replaceKeyPrefixWith` as '/assets/images'. _Cannot be specified along with `replaceKeyWith`_.
210
+
* `replaceKeyWith` specifies a specific page to redirect requests to (e.g. 'landing.html'). _Cannot be specified along with `replaceKeyPrefixWith`_.
211
+
212
+
The `condition` property has two optional parameters:
213
+
214
+
* `keyPrefixEquals` specifies that requests to pages starting with the specified value should be redirected. Often used with the `replaceKeyPrefixWith` and `replaceKeyWith` `redirect` properties.
215
+
* `httpErrorCodeReturnedEquals` specifies that requests resulting in the given HTTP error code (e.g. 404, 500) should be redirected.
216
+
217
+
_If `condition` is not specified, then all requests will be redirected in accordance with the specified `redirect` properties_
_optional_, defaults to value specified in `provider` section of `serverless.yml`
228
+
229
+
```bash
230
+
serverless client deploy --region $REGION
231
+
```
232
+
233
+
Use this parameter to specify what AWS region your bucket will be deployed in.
234
+
235
+
This option will always determine the deployment region if specified. If `region`
236
+
is not specified via the CLI, we use the `region` option specified under
237
+
custom/client in `serverless.yml`. If that is not specified, we use the Serverless
238
+
region specified under `provider` in `serverless.yml`.
239
+
240
+
---
241
+
242
+
**--no-delete-contents**
243
+
244
+
_optional_, default `false` (deletes contents by default)
245
+
246
+
```bash
247
+
serverless client deploy --no-delete-contents
248
+
```
249
+
250
+
Use this parameter if you do not want to delete the contents of your bucket before deployment. Files uploaded during deployment will still replace any corresponding files already in your bucket.
251
+
252
+
---
253
+
254
+
**--no-config-change**
255
+
256
+
_optional_, default `false` (overwrites bucket configuration by default)
257
+
258
+
```bash
259
+
serverless client deploy --no-config-change
260
+
```
261
+
262
+
Use this parameter if you do not want to overwrite the bucket configuration when deploying to your bucket.
263
+
264
+
---
265
+
266
+
**--no-policy-change**
267
+
268
+
_optional_, default `false` (overwrites bucket policy by default)
269
+
270
+
```bash
271
+
serverless client deploy --no-policy-change
272
+
```
273
+
274
+
Use this parameter if you do not want to overwrite the bucket policy when deploying to your bucket.
275
+
276
+
---
277
+
278
+
**--no-cors-change**
279
+
280
+
_optional_, default `false` (overwrites bucket CORS configuration by default)
281
+
282
+
```bash
283
+
serverless client deploy --no-cors-change
284
+
```
285
+
286
+
Use this parameter if you do not want to overwrite the bucket CORS configuration when deploying to your bucket.
287
+
288
+
---
128
289
129
290
## Contributing
130
291
131
292
For guidelines on contributing to the project, please refer to our [Contributing](docs/CONTRIBUTING.md) page.
132
293
133
294
## Release Notes
134
295
296
+
### v2.0.0
297
+
- Major refactor of entire codebase to move towards modularity and testability
298
+
- Added the ability to set HTTP headers for objects in bucket ([Issue 24](https://github.com/fernando-mc/serverless-finch/issues/24))
299
+
- Added the ability to set redirect and routing options for the website (Initially implemented in [Pull 23](https://github.com/fernando-mc/serverless-finch/pull/23))
300
+
- Added command-line options to disable (Initially implemented in [Pull 28](https://github.com/fernando-mc/serverless-finch/pull/28/files)):
301
+
+ Bucket contents being deleted before deployment
302
+
+ Bucket configuration being overwritten on deployment
303
+
+ Bucket policy being overwritten on deployment
304
+
+ Bucket CORS configuration being overwritten on deployment
305
+
- Added validation checks for all configuration options
306
+
- Removed "stage" command-line option. It was not being used for anything
307
+
135
308
### v1.4.\*
136
309
- Added the ability to set custom index and error documents. ([Pull 20](https://github.com/fernando-mc/serverless-finch/pull/20) - [evanseeds](https://github.com/evanseeds))
137
310
@@ -148,6 +321,7 @@ For guidelines on contributing to the project, please refer to our [Contributing
148
321
## Maintainers
149
322
- **You** - If you're interested in having a more active role in development and becoming a maintainer [get in touch](https://www.fernandomc.com/contact/).
150
323
- Fernando Medina Corey - [fernando-mc](https://github.com/fernando-mc)
324
+
- Linus Marco - [linusmarco](https://github.com/linusmarco)
0 commit comments