Skip to content

Commit f56d166

Browse files
committed
🔧 extend nginx server config for CORS
1 parent d5f9c35 commit f56d166

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
location /src/ {
1+
location / {
2+
add_header 'Access-Control-Allow-Origin' $allow_origin;
3+
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
4+
5+
location /src/ {
26
expires 365d;
3-
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS' always;
4-
add_header Cache-Control 'public, no-transform';
5-
}
7+
add_header 'Access-Control-Allow-Origin' $allow_origin;
8+
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
9+
add_header Cache-Control "public, no-transform";
10+
}
611

7-
location ~ ^/loader-.*\.js$ {
12+
location ~ ^/loader-.*\.js$ {
13+
add_header 'Access-Control-Allow-Origin' $allow_origin;
814
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS' always;
915
add_header Cache-Control 'no-cache';
10-
}
16+
}
17+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
map $http_origin $allow_origin {
2+
# Obviously for muenchen.de
3+
~^https?://(.*\.)?muenchen.de(:\d+)?$ $http_origin;
4+
5+
# Test-Site for Magnolia is not under muenchen.de-Domain
6+
~^https?://(.*\.)?swm.de(:\d+)?$ $http_origin;
7+
8+
# And the Header of muenchen.de has it's testpage on this domain...
9+
~^https?://(.*\.)?platformsh.site(:\d+)?$ $http_origin;
10+
11+
# If we need to debug something from our local machines.
12+
~^https?://(.*\.)?localhost(:\d+)?$ $http_origin;
13+
14+
default "";
15+
}

personalization-webcomponents/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export default defineConfig(({ mode }) => {
3333
},
3434
build: {
3535
manifest: true, // required for post build logic in 'processes' folder
36+
minify: true,
3637
rollupOptions: {
3738
input: {
3839
"checklist-detail": "./src/checklist-detail-webcomponent.ts",

0 commit comments

Comments
 (0)