Skip to content

Commit

Permalink
Merge pull request #2 from agileseason/hotfix-basic-auth-with-upstream
Browse files Browse the repository at this point in the history
Remove duplicate location error for basic_auth
  • Loading branch information
morr authored Aug 11, 2021
2 parents dea9cdf + ce90a31 commit 6a1e85b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
chef_rails_nginx CHANGELOG
======================

0.3.17
-----
- Fix duplicate location "/" error when `basic_auth` and `upstream` are enabled #1

0.3.16
-----
- Update nginx to 1.19.10
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
license 'MIT'
description 'Installs/Configures chef_rails_nginx'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.3.16'
version '0.3.17'

depends 'chef_nginx'
depends 'acme'
8 changes: 6 additions & 2 deletions templates/default/nginx_custom.erb
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ server {
ssl_stapling_verify on;
<%- end -%>

<%- if @basic_auth_file -%>
<%- if @basic_auth_file && !@upstream -%>
location <%=@basic_auth_location %> {
auth_basic "Restricted Access!";
auth_basic_user_file <%=@basic_auth_file %>;
}

<%- end -%>

gzip_types
application/atom+xml
application/javascript
Expand Down Expand Up @@ -159,6 +159,10 @@ server {
proxy_pass http://<%= @name %>;
}
location / {
<%- if @basic_auth_file -%>
auth_basic "Restricted Access!";
auth_basic_user_file <%=@basic_auth_file %>;
<%- end -%>
try_files $uri @app;
}
<%- end -%>
Expand Down

0 comments on commit 6a1e85b

Please sign in to comment.