Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuring basic authorization (auth_basic) #98

Closed
platan opened this issue Feb 8, 2019 · 1 comment · Fixed by #99
Closed

Configuring basic authorization (auth_basic) #98

platan opened this issue Feb 8, 2019 · 1 comment · Fixed by #99
Assignees
Labels
enhancement Enhance/improve an existing feature

Comments

@platan
Copy link
Contributor

platan commented Feb 8, 2019

I would like to configure basic authorization. It seems that currently I need my own default.conf.j2 template. And this is what I'm using:

{% for location in item.value.reverse_proxy.locations %}
    location {{ item.value.reverse_proxy.locations[location].location }} {
{# this part below is an extra configuration #}
{% if item.value.reverse_proxy.locations[location].auth_basic is defined %}
        auth_basic "{{ item.value.reverse_proxy.locations[location].auth_basic }}";
{% endif %}
{% if item.value.reverse_proxy.locations[location].auth_basic_file is defined %}
        auth_basic_user_file {{ item.value.reverse_proxy.locations[location].auth_basic_file }};
{% endif %}
{# this part above is an extra configuration #}
        proxy_pass {{ item.value.reverse_proxy.locations[location].proxy_pass }};
{% if item.value.reverse_proxy.health_check_plus is defined and item.value.reverse_proxy.health_check_plus %}
        health_check;
{% endif %}

plus:

          locations:
            prometheus:
              location: /prometheus/
              proxy_pass: http://localhost:9090
              auth_basic: "Restricted Content"
              auth_basic_file: /etc/nginx/.htpasswd.prometheus

I would like to be able to configure basic authorization by one of the following options:

  1. Using dedicated configuration options like auth_basic and auth_basic_file
  2. By generic configuration option like
          locations:
            prometheus:
                extra_options: >
                  auth_basic: "Restricted Content"
                  auth_basic_user_file: /etc/nginx/.htpasswd.prometheus

What do you think about this feature and suggested solutions?

@alessfg
Copy link
Collaborator

alessfg commented Feb 8, 2019

I think it's a great feature to add to this role!

  1. Using dedicated configuration options like auth_basic and auth_basic_file

This would be my preferred approach and would be more in accordance with the way the role is structured atm.

@alessfg alessfg added the enhancement Enhance/improve an existing feature label Feb 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhance/improve an existing feature
Development

Successfully merging a pull request may close this issue.

2 participants