Skip to content

Commit

Permalink
fix(codepipeline): set correct header assignment in S3 deployment cac…
Browse files Browse the repository at this point in the history
…he control (#8864)

The `max-age` and `s-maxage` header properties were assigned using a `:` instead of `=`. This change fixes the assignment to be according to the spec. Also added missing test for the `s-maxage` property.

Fixes #8774


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
nonken authored Jul 7, 2020
1 parent b25fc07 commit be1094b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export class CacheControl {
/** The 'proxy-revalidate' cache control directive. */
public static proxyRevalidate() { return new CacheControl('proxy-revalidate'); }
/** The 'max-age' cache control directive. */
public static maxAge(t: Duration) { return new CacheControl(`max-age: ${t.toSeconds()}`); }
public static maxAge(t: Duration) { return new CacheControl(`max-age=${t.toSeconds()}`); }
/** The 's-max-age' cache control directive. */
public static sMaxAge(t: Duration) { return new CacheControl(`s-maxage: ${t.toSeconds()}`); }
public static sMaxAge(t: Duration) { return new CacheControl(`s-maxage=${t.toSeconds()}`); }
/**
* Allows you to create an arbitrary cache control directive,
* in case our support is missing a method for a particular directive.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@
},
"Extract": "true",
"CannedACL": "public-read",
"CacheControl": "public, max-age: 43200"
"CacheControl": "public, max-age=43200"
},
"InputArtifacts": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export = {
cacheControl: [
cpactions.CacheControl.setPublic(),
cpactions.CacheControl.maxAge(Duration.hours(12)),
cpactions.CacheControl.sMaxAge(Duration.hours(12)),
],
});

Expand All @@ -118,7 +119,7 @@ export = {
'Actions': [
{
'Configuration': {
'CacheControl': 'public, max-age: 43200',
'CacheControl': 'public, max-age=43200, s-maxage=43200',
},
},
],
Expand Down

0 comments on commit be1094b

Please sign in to comment.