From ed4d07957bcedc18f024aa6833c817b0aea263ac Mon Sep 17 00:00:00 2001 From: antelle Date: Thu, 7 Apr 2016 20:27:32 +0300 Subject: [PATCH] Updated WebDAV Config (markdown) --- WebDAV-Config.md | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/WebDAV-Config.md b/WebDAV-Config.md index 1c6fdf3..47bf1d6 100644 --- a/WebDAV-Config.md +++ b/WebDAV-Config.md @@ -2,7 +2,7 @@ To use WebDAV-located file from web app, CORS must be enabled on your server. He For Apache: ``` -Header always add Access-Control-Allow-Origin "*" +Header always set Access-Control-Allow-Origin "*" Header always set Access-Control-Allow-Headers "origin, content-type, accept, authorization, if-match, destination, overwrite" Header always set Access-Control-Expose-Headers "ETag" Header always set Access-Control-Allow-Methods "GET, HEAD, POST, PUT, OPTIONS, MOVE, DELETE, COPY, LOCK, UNLOCK" @@ -15,22 +15,15 @@ RewriteRule ^(.*)$ blank.html [R=200,L,E=HTTP_ORIGIN:%{HTTP:ORIGIN}] For nginx: ``` +add_header 'Access-Control-Allow-Origin' '*'; +add_header 'Access-Control-Allow-Credentials' 'true'; +add_header 'Access-Control-Allow-Methods' 'GET, HEAD, POST, PUT, OPTIONS, MOVE, DELETE, COPY, LOCK, UNLOCK'; +add_header 'Access-Control-Allow-Headers' 'Authorization,DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Accept-Charset,X-Accept,origin,accept,if-match,destination, overwrite'; +add_header 'Access-Control-Expose-Headers' 'ETag'; +add_header 'Access-Control-Max-Age' 1728000; if ($request_method = 'OPTIONS') { - add_header 'Access-Control-Allow-Origin' '*'; - add_header 'Access-Control-Allow-Credentials' 'true'; - add_header 'Access-Control-Allow-Methods' 'GET, HEAD, POST, PUT, OPTIONS, MOVE, DELETE, COPY, LOCK, UNLOCK'; - add_header 'Access-Control-Allow-Headers' 'Authorization,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Accept-Charset,X-Accept,origin,accept,if-match,destination, overwrite'; - add_header 'Access-Control-Expose-Headers' 'ETag'; - add_header 'Access-Control-Max-Age' 1728000; add_header 'Content-Type' 'text/plain charset=UTF-8'; add_header 'Content-Length' 0; return 204; } - -add_header 'Access-Control-Allow-Origin' '*'; -add_header 'Access-Control-Allow-Credentials' 'true'; -add_header 'Access-Control-Allow-Methods' 'GET, HEAD, POST, PUT, OPTIONS, MOVE, DELETE, COPY, LOCK, UNLOCK'; -add_header 'Access-Control-Allow-Headers' 'Authorization,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Accept-Charset,X-Accept,origin,accept,if-match,destination, overwrite'; -add_header 'Access-Control-Expose-Headers' 'ETag'; -add_header 'Access-Control-Max-Age' 1728000; ``` \ No newline at end of file