From e5927868b6a8de9c35f15e8e4bbd1ac2f6d57f2f Mon Sep 17 00:00:00 2001 From: Raphael Parree Date: Wed, 17 Oct 2018 13:12:01 +0200 Subject: [PATCH] disable basic authentication for HTTP OPTIONS for CORS --- nginx.tmpl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nginx.tmpl b/nginx.tmpl index d861050..6c87653 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -285,8 +285,10 @@ server { {{ end }} {{ if (exists (printf "/etc/nginx/htpasswd/%s" $host)) }} - auth_basic "Restricted {{ $host }}"; - auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s" $host) }}; + limit_except OPTIONS { + auth_basic "Restricted {{ $host }}"; + auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s" $host) }}; + } {{ end }} {{ if (exists (printf "/etc/nginx/vhost.d/%s_location" $host)) }} include {{ printf "/etc/nginx/vhost.d/%s_location" $host}};