Pdf Download via Https

1. The problem I’m having:

I’m trying to make pdf downloads work via https. Right now, everything else (pdf upload, api, etc)is working via https and the domain name, but pdf download only works via http and the ip address. The pdfs are stored in a database and retrieved by an api GET. I think the problem is that the frontend is on port 5173 but the api endpoint is 8080/api/v1 and i dont know how to correctly put that into the caddyfile.

For reference this is how I’m requesting the pdf:

 <a target="_blank" class="btn btn-primary" href={api.routes.pdf_overview_download(data.uuid)}>Download Overview PDF</a>

The url currently resolves to http://139.18.8.225:8080/api/v1/download/{uuid}, but i want it to be https://creditport.fmi.uni-leipzig.de/download/{uuid}

2. Error messages and/or full log output:

I’m not really getting an error, i just dont know how to do it

3. Caddy version:

v2.9.1

4. How I installed and ran Caddy:

Standard apt package + systemctl

a. System environment:

Debian 6

d. My complete Caddy config:

creditport.fmi.uni-leipzig.de {
        reverse_proxy localhost:5173
        handle_errors {
                root * /var/www/creditport
                rewrite * /{err.status_code}.html
                file_server {
                        status {err.status_code}
                }
        }
}

Your app that’s running on 5173 receives the correct hostname in the Host header. Just use that. It’s not a Caddyfile thing. It’s a webdev thing.