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

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

Hi,

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?


EDIT:
--------------------------------------------
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.
Reply


Messages In This Thread
Best way to rewrite and/or extend requests [SOLVED] - by superior - 03-12-2022, 01:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB