Skip to content

simple Basic Authentication for localhost #29

Open
@digitalkaoz

Description

@digitalkaoz

i dont want to secure a secondary container, but instead protect a served folder locally like this:

server {
    server_name example.com;
    root /var/www/web_root/;
    index index.html;

    auth_basic "Restricted";
    auth_basic_user_file auth.htpasswd;
}

any way we can make this happen? currently its really just a proxy (resulting in an endless loop) when started with localhost:

FORWARD_HOST=127.0.0.1

server {
 listen 80 default_server;

 location / {
     auth_basic              "Restricted";
     auth_basic_user_file    auth.htpasswd;

     proxy_pass                          http://127.0.0.1:80;
     proxy_read_timeout                  900;
 }
}

currently i am solving it like this:

server {
 listen 80 default_server;
 auth_basic              "Restricted";
 auth_basic_user_file    auth.htpasswd;
 root /usr/share/nginx/html;
 index index.html;
}
FROM beevelop/nginx-basic-auth

COPY html_files /usr/share/nginx/html
COPY nginx.conf /opt/auth.conf

it works, but it would be cool if it works without local files and custom containers. Just an idea...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions