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

htpasswd folder doesn't work anymore / no basic auth #2423

Closed
Emporea opened this issue Apr 18, 2024 · 1 comment
Closed

htpasswd folder doesn't work anymore / no basic auth #2423

Emporea opened this issue Apr 18, 2024 · 1 comment

Comments

@Emporea
Copy link

Emporea commented Apr 18, 2024

I had previously configured this setup, which involved several files for domains in the htpasswd folder to enable basic authentication.

I recently created a new setup on a different machine using the same Docker Compose files and domain names, but encountered an issue where basic authentication no longer functions as intended. Instead of prompting for authentication, the system simply opens the sites directly.

I then deleted all htpasswd files and recreated them using the apache2-utils tool. I checked that these files were visible in the proxy docker container, which they were.

No error messages or other indications of failure were observed.

Dockerfile:

FROM nginxproxy/nginx-proxy:alpine
COPY uploadsize.conf /etc/nginx/conf.d/uploadsize.conf

# I also tried this, instead of mounting via docker-compose, but this also didn't work.
#ADD htpasswd /etc/nginx/htpasswd 
...
  proxy:
    build: ./proxy
    restart: unless-stopped
    container_name: proxy
    ports:
      - 80:80
      - 443:443
    labels:
      com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
    volumes:
      - ./proxy/htpasswd:/etc/nginx/htaccess:ro # doesnt work anymore.
      - proxy_certs:/etc/nginx/certs:z,ro
      - proxy_vhost.d:/etc/nginx/vhost.d:z
      - proxy_html:/usr/share/nginx/html:z
      - /var/run/docker.sock:/tmp/docker.sock:z,ro

  letsencrypt-companion:
    image: nginxproxy/acme-companion
    restart: unless-stopped
    container_name: letsencrypt-companion
    volumes:
      - proxy_certs:/etc/nginx/certs:z
      - proxy_acme:/etc/acme.sh:z
      - proxy_vhost.d:/etc/nginx/vhost.d:z
      - proxy_html:/usr/share/nginx/html:z
      - /var/run/docker.sock:/var/run/docker.sock:z,ro
...
@SchoNie
Copy link
Contributor

SchoNie commented Apr 18, 2024

I suggest reading: basic-authentication-support in the docs.
You can also check out the tests compose files to see more real world examples.

No manual dockerfile ADD or COPY tricks are needed. Check the filename of your password file according to the docs.
Also check your volume: /etc/nginx/htaccess which should be /etc/nginx/htpasswd.

@Emporea Emporea closed this as completed May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants