- Edited
Tonight a netizen asked a question in flarum cn discussion. He deploy a flarum and used Tencent CDN as reverse proxy. But ip_address
in dbms are all wrong.
I tested, and it can reproduce in my developing enviroment by Host Chrome -> Host Caddy -> Dockered Nginx and Dockered php-fpm Flarum
. Real ip_adress
may 10.240.***.***
as I am using 10.240.***.***
to connect to caddy, but I got docker ip 172.0.***.***
.
We noticed that flarum got remote ip by $SERVER['REMOTE_ADDR']
, but if we use a flarum instance behind proxy like Ingress or Cloudflare, it may not work as well as we thought.
Refer to Laravel document and Symfony document
https://github.com/laravel/framework/blob/9.x/src/Illuminate/Http/Middleware/TrustProxies.php
https://github.com/symfony/http-foundation/blob/6.1/Request.php#L565
Symfony provides a simple way to get the whole proxy chain, but Flarum doesn't dut to laminas/laminas-diactoros
did not contains a function like this.
Does flarum is planning to support X-Forward-
seris header?
Relevant topic