1. Caddy version (caddy version
): v2.3.0
2. How I run Caddy:
a. System environment:
Via docker on Google’s Container Optimized OS, caddy:2-alpine image.
b. Command:
I don’t have the original docker run command I used but it was something like
docker run --name=caddy --volume=/var/data/caddy/Caddyfile:/etc/caddy/Caddyfile -p 443:443 -p 80:80 caddy:2-alpine
c. Service/unit/compose file:
none
d. My complete Caddyfile or JSON config:
{
email xxxxxxxx
}
db.xxxxxxxx {
@adminlogin {
path /admin/login/*
query password=*
}
handle @adminlogin {
request_header +Authorization "Basic XXXXXXXX"
rewrite * /admins/_design/admin/_update/login/{path}
}
reverse_proxy couchdb:5984
}
3. The problem I’m having:
Hello there.
I’m trying to expose a couple of endpoints from a CouchDB database that requires Basic HTTP authentication. This works perfectly for every endpoint that doesn’t have any parameters appended to the URL.
For this specific case, I need for the URL https://db.xxxxxxxx/admin/login/some_id
that includes a query param password
to be rewrited to https://db.xxxxxxxx/admins/_design/admin/_update/login/some_id
, keeping the query parameters and adding the basic authentication header with the token hardcoded.
I think the only thing is not working is appending the some_id
param to the rewrite destination.
Thank you so much!
4. Error messages and/or full log output:
No errors.