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

fix(aws-s3-deployment): Set proper s-maxage Cache Control header #8434

Merged
merged 2 commits into from
Jun 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class CacheControl {
/** The 'max-age' cache control directive. */
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-max-age: ${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 @@ -283,7 +283,7 @@ export class CacheControl {
public static setPrivate() { return new CacheControl('private'); }
public static proxyRevalidate() { return new CacheControl('proxy-revalidate'); }
public static maxAge(t: cdk.Duration) { return new CacheControl(`max-age=${t.toSeconds()}`); }
public static sMaxAge(t: cdk.Duration) { return new CacheControl(`s-max-age=${t.toSeconds()}`); }
public static sMaxAge(t: cdk.Duration) { return new CacheControl(`s-maxage=${t.toSeconds()}`); }
public static fromString(s: string) { return new CacheControl(s); }

private constructor(public readonly value: any) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ export = {
test.equal(s3deploy.CacheControl.setPrivate().value, 'private');
test.equal(s3deploy.CacheControl.proxyRevalidate().value, 'proxy-revalidate');
test.equal(s3deploy.CacheControl.maxAge(cdk.Duration.minutes(1)).value, 'max-age=60');
test.equal(s3deploy.CacheControl.sMaxAge(cdk.Duration.minutes(1)).value, 's-max-age=60');
test.equal(s3deploy.CacheControl.sMaxAge(cdk.Duration.minutes(1)).value, 's-maxage=60');
test.equal(s3deploy.CacheControl.fromString('only-if-cached').value, 'only-if-cached');

test.done();
Expand Down