1. The problem I’m having:
I am migrating form Nginx Proxy Manager and so far it’s great, but I have a deluge docker service which uses custom css called by NPM like so:
That custom configuration is
proxy_set_header Accept-Encoding "";
sub_filter
'</head>'
'<link rel="stylesheet" type="text/css" href="https://halianelf.github.io/Deluge-Dark/deluge.css">
</head>';
sub_filter_once on;
I’ve been reading docs for the last few hours, and I already got far with other matters, but not that one. How can I convert it into a Caddyfile format?
System environment:
docker+portainer on Archlinux
Unfortunately, it’s not possible. I use caddy-docker-proxy as my main use-case, so I build the image like so:
FROM caddy:2.7.6-builder-alpine AS builder
RUN xcaddy build \
--with github.com/lucaslorentz/caddy-docker-proxy/v2 \
--with github.com/caddyserver/replace-response
FROM caddy:2.7.6-alpine
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
Image builds fine, and container is created flawlessly, but then the resulting caddy does not work as it should. It does not read containers from docker, so any auto-detected redirect is broke, and those that are hard-coded, like redirects to IP, also don’t work - so the entire install is completely unusable.
You have to use the docker-proxy
command in your Dockerfile:
Ah, good catch. I was using caddy docs instead.
Anyway, I am back to my original question - how to I convert the Nginx configuration into a Caddfile format?
Read the plugin’s README. You configure it to replace </head>
with your text including the CSS stylesheet.
I ready it several times before I repeated my question. I still don’t understand how to convert it.