Merge pull request #1288 from dwelch2344/master

Allow PATCH in enable-cors
This commit is contained in:
Manuel Alejandro de Brito Fontes 2017-09-02 17:42:33 -03:00 committed by GitHub
commit 528cb8b040

View file

@ -523,7 +523,7 @@ stream {
# Om nom nom cookies # Om nom nom cookies
# #
add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, OPTIONS'; add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, PATCH, OPTIONS';
# #
# Custom headers and headers various browsers *should* be OK with but aren't # Custom headers and headers various browsers *should* be OK with but aren't
# #
@ -549,11 +549,14 @@ stream {
if ($request_method = 'DELETE') { if ($request_method = 'DELETE') {
set $cors_method 1; set $cors_method 1;
} }
if ($request_method = 'PATCH') {
set $cors_method 1;
}
if ($cors_method = 1) { if ($cors_method = 1) {
add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, OPTIONS'; add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, PATCH, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization'; add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
} }
{{ end }} {{ end }}