Skip to content

Commit f719770

Browse files
authored
chore: remove nginx cors (#1557)
1 parent fe409ca commit f719770

File tree

1 file changed

+0
-60
lines changed

1 file changed

+0
-60
lines changed

nginx/nginx.conf

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,6 @@ http {
5252

5353
# GoTrue
5454
location /gotrue/ {
55-
if ($request_method = 'OPTIONS') {
56-
add_header 'Access-Control-Allow-Origin' $cors_origin always;
57-
add_header 'Access-Control-Allow-Credentials' 'true' always;
58-
add_header 'Access-Control-Allow-Headers' '*' always;
59-
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
60-
add_header 'Access-Control-Max-Age' 3600 always;
61-
add_header 'Content-Type' 'text/plain charset=UTF-8' always;
62-
add_header 'Content-Length' 0 always;
63-
return 204;
64-
}
65-
6655
proxy_pass $gotrue_backend;
6756

6857
rewrite ^/gotrue(/.*)$ $1 break;
@@ -75,24 +64,6 @@ http {
7564

7665
# WebSocket
7766
location /ws {
78-
# Handle preflight OPTIONS requests
79-
if ($request_method = 'OPTIONS') {
80-
add_header 'Access-Control-Allow-Origin' $cors_origin always;
81-
add_header 'Access-Control-Allow-Credentials' 'true' always;
82-
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, X-Requested-With' always;
83-
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
84-
add_header 'Access-Control-Max-Age' 1728000 always;
85-
add_header 'Content-Type' 'text/plain charset=UTF-8' always;
86-
add_header 'Content-Length' 0 always;
87-
return 204;
88-
}
89-
90-
# Add CORS headers to all responses
91-
add_header 'Access-Control-Allow-Origin' $cors_origin always;
92-
add_header 'Access-Control-Allow-Credentials' 'true' always;
93-
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, X-Requested-With' always;
94-
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
95-
9667
# Existing proxy configuration
9768
proxy_pass $appflowy_cloud_backend;
9869

@@ -111,36 +82,11 @@ http {
11182
proxy_set_header X-Request-Id $request_id;
11283
proxy_set_header Host $http_host;
11384

114-
# Set CORS headers for other requests
115-
if ($request_method = 'OPTIONS') {
116-
add_header 'Access-Control-Allow-Origin' $cors_origin always;
117-
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
118-
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, Accept, Client-Version, Device-Id' always;
119-
add_header 'Access-Control-Max-Age' 3600 always;
120-
return 204;
121-
}
122-
123-
add_header 'Access-Control-Allow-Origin' $cors_origin always;
124-
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
125-
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, Accept, Client-Version, Device-Id' always;
126-
add_header 'Access-Control-Max-Age' 3600 always;
12785

12886
location ~* ^/api/workspace/([a-zA-Z0-9_-]+)/publish$ {
12987
proxy_pass $appflowy_cloud_backend;
13088
proxy_request_buffering off;
13189
client_max_body_size 256M;
132-
if ($request_method = 'OPTIONS') {
133-
add_header 'Access-Control-Allow-Origin' $cors_origin always;
134-
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
135-
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, Accept, Client-Version, Device-Id' always;
136-
add_header 'Access-Control-Max-Age' 3600 always;
137-
return 204;
138-
}
139-
140-
add_header 'Access-Control-Allow-Origin' $cors_origin always;
141-
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
142-
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, Accept, Client-Version, Device-Id' always;
143-
add_header 'Access-Control-Max-Age' 3600 always;
14490
}
14591

14692
# AppFlowy-Cloud
@@ -165,12 +111,6 @@ http {
165111
proxy_set_header X-Request-Id $request_id;
166112
proxy_set_header Host $http_host;
167113

168-
# Handle CORS
169-
add_header 'Access-Control-Allow-Origin' $cors_origin always;
170-
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
171-
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, Accept, Device-Id' always;
172-
add_header 'Access-Control-Max-Age' 3600 always;
173-
174114
# Timeouts
175115
proxy_read_timeout 600s;
176116
proxy_connect_timeout 600s;

0 commit comments

Comments
 (0)