Skip to content

Rate-limiter receiving internal IP of proxy container #263

@ghost

Description

I would like to preface this issue with a note that my setup is rather unusual - I using an Oracle free tier to mess around with podman before deploying to my main server, and as a result I tend to be a very niche use case.

Initially, I had the stack running rootless with caddy as a reverse proxy. This was working fine, with one notable exception: in rootless podman, all remote address will have an IP of the forwarded container, due to the way podman handles rootless port forwarding (containers/podman#8193). This means, of course that the rate-limiter also receives that IP. Now, being myself, I looked around for alternatives and found this[1], which I am now using.

Here is the run command for the cadence server, for example:

sudo podman run -d \
--name=cadence \
--uidmap="0:$(id -u opc):1" \
--uidmap="1:$(grep -Po '(?<=^opc:).*$' /etc/subuid | head -1)" \
--requires=liquidsoap,postgres,icecast2,redis \
--env-file /home/opc/cadence/config/cadence.env \
--label "io.containers.autoupdate=registry" \
-v /home/opc/radio:/home/opc/radio:z \
--user 103 \
--net cadencenet \
--net caddynet \
--restart always \
docker.io/kenellorando/cadence

This has the desired effect - caddy now has the proper IP:

"request":{"remote_ip":"198.54.132.254","remote_port":"59365","client_ip":"198.54.132.254","proto":"HTTP/2.0","method":"GET","host":"cadence:8080","uri":"/api/radiodata/sse"

Unfortunately, cadence doesn't seem to agree:

2024/06/09 19:29:21 INFO IP <10.89.0.7> is rate limited. func=rateLimitArt

Where 10.89.0.7 is caddy's IP on caddynet. This leads me to believe that cadence is not properly trusting external proxies, as caddy sends all required headers by default. Everything else is working fine, as with the completely rootless setup.

[1] There are other options, such as --network slirp4netns:port_handler=slirp4netns and using a pod, but I was too lazy to reconfigure cadence's networking.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions