mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 08:57:10 -06:00
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)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control public,immutable;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
}
|
||||
|
||||
location = /srv/status {
|
||||
@ -135,7 +134,6 @@ server {
|
||||
location ~ ^/javascripts/ {
|
||||
expires 1d;
|
||||
add_header Cache-Control public,immutable;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
}
|
||||
|
||||
location ~ ^/assets/(?<asset_path>.+)$ {
|
||||
@ -183,10 +181,12 @@ server {
|
||||
|
||||
# custom CSS
|
||||
location ~ /stylesheet-cache/ {
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
try_files $uri =404;
|
||||
}
|
||||
# this allows us to bypass rails
|
||||
location ~* \.(gif|png|jpg|jpeg|bmp|tif|tiff|ico|webp)$ {
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
try_files $uri =404;
|
||||
}
|
||||
# SVG needs an extra header attached
|
||||
@ -194,6 +194,7 @@ server {
|
||||
}
|
||||
# thumbnails & optimized images
|
||||
location ~ /_?optimized/ {
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
@ -252,6 +253,7 @@ server {
|
||||
break;
|
||||
}
|
||||
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
# this means every file in public is tried first
|
||||
try_files $uri @discourse;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user