Skip to content

Commit

Permalink
Merge pull request #1035 from jseniuk/main
Browse files Browse the repository at this point in the history
Allow OPTIONS requests when using basic auth
  • Loading branch information
tobybellwood authored Jul 8, 2024
2 parents ceaf011 + 879c18b commit 4163c2c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions images/nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ COPY fastcgi.conf /etc/nginx/fastcgi.conf
COPY fastcgi.conf /etc/nginx/fastcgi_params
COPY helpers/ /etc/nginx/helpers/
COPY static-files.conf /etc/nginx/conf.d/app.conf
COPY basic_auth.conf /etc/nginx/conf.d/basic_auth.conf
COPY redirects-map.conf /etc/nginx/redirects-map.conf
COPY healthcheck/healthz.locations healthcheck/healthz.locations.php.disable /etc/nginx/conf.d/

Expand Down
5 changes: 5 additions & 0 deletions images/nginx/basic_auth.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
map $request_method $use_basic_auth {
# Disable auth on OPTIONS requests, nothing else
default "${BASIC_AUTH:-off}";
OPTIONS off;
}
4 changes: 2 additions & 2 deletions images/nginx/helpers/020_basic-auth.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# BASIC_AUTH is set during docker-entrypoint if BASIC_AUTH_USERNAME and BASIC_AUTH_PASSWORD are set
auth_basic "${BASIC_AUTH:-off}";
auth_basic_user_file "/etc/nginx/.htpasswd";
auth_basic $use_basic_auth;
auth_basic_user_file "/etc/nginx/.htpasswd";

0 comments on commit 4163c2c

Please sign in to comment.