Skip to content

Commit 5eb2b72

Browse files
authored
Merge pull request #510 from divyav-aot/rsbc/7.0.0
Merge to Main Repo
2 parents 6afd43c + b2b56b9 commit 5eb2b72

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

nginx.conf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ http {
3333
gzip_comp_level 6;
3434
gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
3535

36+
# Add CORS map to handle CORS preflight requests
37+
map $request_method $cors_method {
38+
OPTIONS 'true';
39+
default '';
40+
}
41+
3642
server {
3743
# add in most common security headers
3844
add_header Content-Security-Policy "default-src * data: blob: filesystem: 'unsafe-inline' 'unsafe-eval'";
@@ -41,13 +47,24 @@ http {
4147
add_header X-XSS-Protection 1;
4248
add_header X-Frame-Options SAMEORIGIN;
4349

50+
# Add CORS headers to all responses
51+
add_header 'Access-Control-Allow-Origin' '*' always;
52+
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
53+
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always;
54+
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
55+
4456
listen 8080;
4557
server_name _;
4658

4759
index index.html;
4860
error_log /dev/stdout info;
4961
access_log /dev/stdout;
5062

63+
# Handle preflight OPTIONS requests
64+
if ($cors_method) {
65+
return 204;
66+
}
67+
5168
# Serve versioned static files
5269
location ~ ^/forms-flow-.*@.*/.*$ {
5370
root /usr/share/nginx/html;

0 commit comments

Comments
 (0)