@@ -273,6 +273,28 @@ server {
273
273
{{ end }}
274
274
275
275
location / {
276
+ if ($request_method = 'OPTIONS') {
277
+ add_header 'Access-Control-Allow-Origin' '*';
278
+ add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
279
+ add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
280
+ add_header 'Access-Control-Max-Age' 1728000;
281
+ add_header 'Content-Type' 'text/plain; charset=utf-8';
282
+ add_header 'Content-Length' 0;
283
+ return 204;
284
+ }
285
+ if ($request_method = 'POST') {
286
+ add_header 'Access-Control-Allow-Origin' '*';
287
+ add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
288
+ add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
289
+ add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
290
+ }
291
+ if ($request_method = 'GET') {
292
+ add_header 'Access-Control-Allow-Origin' '*';
293
+ add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
294
+ add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
295
+ add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
296
+ }
297
+
276
298
{{ if eq $proto "uwsgi" }}
277
299
include uwsgi_params;
278
300
uwsgi_pass {{ trim $proto }}://{{ trim $upstream_name }};
0 commit comments