Welcome Guest, Not a member yet? Register   Sign In
Best way to rewrite and/or extend requests [SOLVED]

(This post was last modified: 03-13-2022, 05:37 AM by superior.)


I'm rewriting my project to CodeIgniter 4 previously build in CodeIgniter 3, this project has always been behind Cloudflare to protect certain information and for security reasons.
Cloudflare rewrites the REMOTE_ADDR to an IP the visitor is send on by proxy, but they also send the visitors IP with HTTP_CF_CONNECTING_IP so we can still see what address is connecting.

I could write a helper but the system is also relying on REMOTE_ADDR for example in sessions, so that would be a massive workaround.
Is there a propper way to extend the class/method so I can set a different server global if this global is available?

Found the solution, this should be done in App\Config::proxyIPs.
Created a different config to get IP-addresses provided by Cloudflare through text files (IPv4 & IPv6).
I'm storing this information inside a cache file refreshed daily so it can read any changes as well.

Please edit your Post Title and add [SOLVED] to the end of it.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

(03-13-2022, 01:03 AM)InsiteFX Wrote: Please edit your Post Title and add [SOLVED] to the end of it.

Done, thank you :-)

Theme © iAndrew 2016 - Forum software by © MyBB