nforwardauth: Basic auth in URL not working with Caddy

Thanks for your work on this, everything is working great except I can’t pass basic auth through the url to skip the login page.

For example, http://user:pass@service.example.xyz just takes me to the login page without signing in.

I’m guessing its due to something I need to add to my Caddy config? I’ve provided my docker and caddy set up below.

Docker compose

services:
  nforwardauth:
    image: nosduco/nforwardauth:v1
    container_name: auth
    environment:
      - PUID=1026
      - PGID=1000
      - TZ=Country/City
      - TOKEN_SECRET=examplesecret
      - AUTH_HOST=auth.example.xyz
      - COOKIE_DOMAIN=example.xyz
      - PORT=3000
    volumes:
      - ./passwd/passwd.txt:/passwd:ro
    ports:
      - 3000:3000
    restart: unless-stopped 

Caddyfile

auth.example.xyz {
	reverse_proxy http://127.0.0.1:3000
}

service.example.xyz {
	forward_auth http://127.0.0.1:3000 {
		uri /
	}
	reverse_proxy http://127.0.0.1:1111
}

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 18 (11 by maintainers)

Most upvoted comments

@nosduco copy-headers works the other way round:

copy_headers is a list of HTTP header fields to copy from the response to the original request, when the request has a success status code.

I think this might work:

forward_auth http://127.0.0.1:3000 {
	uri /
        header_up Authorization {header.Authorization}
}