XF 2.1 Check for XF-Forwarded-For for api calls or let XF\Http\Request run through the class proxy

Zambfd

New member
Hi,

we implemented the xenforo threads as a comment section in our frontend and create new posts and threads through the api ( Super User Key ).

But because of that every user interaction with the frontend is now stored with the server ip address in xenforo because the api retreives the current ip with ->getIp() not ->getIp(true) for the proxy check.

I tried to extend the Request class to override the getIp() method but this class is not pushed through the class proxy ...

Any solutions except for that the developers should change the core code? ^^

Regards
 

Liam W

Well-known member
If it's for an internal website, and you're not planning on releasing it as an add-on, you can override your site's Request object manually through the config.php file (by setting $config['container']['request'] to a function that instantiates and returns a request instance, see the App class for details).

You might be able to accomplish the same thing using the app_pub_setup event, but it isn't recommended and shouldn't be used on a released add-on.
 
Top