Skip to content

A platform for community discussion. Free, open, simple.

DEV: add CORS header for all nginx rules of public folder files. (#12205)

Vinoth Kannan437c34859895
diff --git a/config/nginx.sample.conf b/config/nginx.sample.conf
index 62e619e9ec0..3993ff8cc9a 100644
--- a/config/nginx.sample.conf
+++ b/config/nginx.sample.conf
@@ -115,6 +115,7 @@ 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 {
@@ -134,6 +135,7 @@ server {
location ~ ^/javascripts/ {
expires 1d;
add_header Cache-Control public,immutable;
+ add_header Access-Control-Allow-Origin *;
}
location ~ ^/assets/(?<asset_path>.+)$ {
@@ -150,12 +152,14 @@ server {
location ~ ^/plugins/ {
expires 1y;
add_header Cache-Control public,immutable;
+ add_header Access-Control-Allow-Origin *;
}
# cache emojis
location ~ /images/emoji/ {
expires 1y;
add_header Cache-Control public,immutable;
+ add_header Access-Control-Allow-Origin *;
}
location ~ ^/uploads/ {
@@ -253,7 +257,6 @@ server {
break;
}
- add_header Access-Control-Allow-Origin *;
# this means every file in public is tried first
try_files $uri @discourse;
}