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

actions/spa-setup-task: merge server-snippet into configuration-snippet #228

Merged
merged 1 commit into from
Sep 5, 2024
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
13 changes: 12 additions & 1 deletion actions/spa-setup-task/__tests__/k8s.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,24 @@ test('ingressAnnotations()', () => {

const annotations = k8s.ingressAnnotations(bucketPath, bucketVhost) || {}

expect(Object.keys(annotations || {}).length).toBe(6)
expect(Object.keys(annotations || {}).length).toBe(5)
expect(annotations['nginx.ingress.kubernetes.io/upstream-vhost']).toBe(
bucketVhost
)
expect(annotations['nginx.ingress.kubernetes.io/backend-protocol']).toBe(
'https'
)
expect(annotations['nginx.ingress.kubernetes.io/configuration-snippet']).toBe(
`more_set_headers "Cache-Control: public,max-age=0";
rewrite ^(.*)/$ ${bucketPath}/index.html break;
rewrite ^/(.*)$ ${bucketPath}/$1 break;
proxy_intercept_errors on;
error_page 404 = /index.html;`
)
expect(annotations['nginx.ingress.kubernetes.io/from-to-www-redirect']).toBe(
'true'
)
expect(annotations['nginx.ingress.kubernetes.io/use-regex']).toBe('true')
Object.keys(annotations || {}).forEach(key => {
expect(key.startsWith('nginx.ingress.kubernetes.io')).toBe(true)
})
Expand Down
6 changes: 3 additions & 3 deletions actions/spa-setup-task/dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion actions/spa-setup-task/dist/index.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions actions/spa-setup-task/src/k8s.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ export function ingressAnnotations(
'nginx.ingress.kubernetes.io/from-to-www-redirect': 'true',
'nginx.ingress.kubernetes.io/use-regex': 'true',
'nginx.ingress.kubernetes.io/backend-protocol': 'https',
'nginx.ingress.kubernetes.io/server-snippet': `proxy_intercept_errors on;
error_page 404 = /index.html;`,
'nginx.ingress.kubernetes.io/configuration-snippet': `more_set_headers "Cache-Control: public,max-age=0";
rewrite ^(.*)/$ ${bucketPath}/index.html break;
rewrite ^/(.*)$ ${bucketPath}/$1 break;`
rewrite ^/(.*)$ ${bucketPath}/$1 break;
proxy_intercept_errors on;
error_page 404 = /index.html;`
}
}

Expand Down
Loading