DEV: add CORS header for all files served from public folder. (#12119)
It's required when we enable cors mod in service worker.
This commit is contained in:
parent
e0f0fe5624
commit
d628c65af0
|
@ -115,7 +115,6 @@ server {
|
||||||
location ~* (fonts|assets|plugins|uploads)/.*\.(eot|ttf|woff|woff2|ico|otf)$ {
|
location ~* (fonts|assets|plugins|uploads)/.*\.(eot|ttf|woff|woff2|ico|otf)$ {
|
||||||
expires 1y;
|
expires 1y;
|
||||||
add_header Cache-Control public,immutable;
|
add_header Cache-Control public,immutable;
|
||||||
add_header Access-Control-Allow-Origin *;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
location = /srv/status {
|
location = /srv/status {
|
||||||
|
@ -135,7 +134,6 @@ server {
|
||||||
location ~ ^/javascripts/ {
|
location ~ ^/javascripts/ {
|
||||||
expires 1d;
|
expires 1d;
|
||||||
add_header Cache-Control public,immutable;
|
add_header Cache-Control public,immutable;
|
||||||
add_header Access-Control-Allow-Origin *;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^/assets/(?<asset_path>.+)$ {
|
location ~ ^/assets/(?<asset_path>.+)$ {
|
||||||
|
@ -183,10 +181,12 @@ server {
|
||||||
|
|
||||||
# custom CSS
|
# custom CSS
|
||||||
location ~ /stylesheet-cache/ {
|
location ~ /stylesheet-cache/ {
|
||||||
|
add_header Access-Control-Allow-Origin *;
|
||||||
try_files $uri =404;
|
try_files $uri =404;
|
||||||
}
|
}
|
||||||
# this allows us to bypass rails
|
# this allows us to bypass rails
|
||||||
location ~* \.(gif|png|jpg|jpeg|bmp|tif|tiff|ico|webp)$ {
|
location ~* \.(gif|png|jpg|jpeg|bmp|tif|tiff|ico|webp)$ {
|
||||||
|
add_header Access-Control-Allow-Origin *;
|
||||||
try_files $uri =404;
|
try_files $uri =404;
|
||||||
}
|
}
|
||||||
# SVG needs an extra header attached
|
# SVG needs an extra header attached
|
||||||
|
@ -194,6 +194,7 @@ server {
|
||||||
}
|
}
|
||||||
# thumbnails & optimized images
|
# thumbnails & optimized images
|
||||||
location ~ /_?optimized/ {
|
location ~ /_?optimized/ {
|
||||||
|
add_header Access-Control-Allow-Origin *;
|
||||||
try_files $uri =404;
|
try_files $uri =404;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,6 +253,7 @@ server {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_header Access-Control-Allow-Origin *;
|
||||||
# this means every file in public is tried first
|
# this means every file in public is tried first
|
||||||
try_files $uri @discourse;
|
try_files $uri @discourse;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue