XF 2.1 Image Proxy Solutions

bebosny

Member
Hello,

My forum runs behind Cloudflare and to prevent the origin IP from being revealed I'm looking to proxy http img embeds of my forum through a different server.
There's some services out there, such as https://images.weserv.nl/ where you can append an image to an URL and it'll proxy it for you (including caching, CDN, etc). It's free too so it seems somewhat unnecessary to host a separate server for image proxying.

It works like this:
Let's say you're trying to proxy this image because it's not HTTPS:

Code:
http://i.imgur.com/FLU5cl6.png

You would convert the URL to this and it would serve over HTTPS:
Code:
https://images.weserv.nl/?url=http://i.imgur.com/FLU5cl6.png

Initially I thought I could achieve this behaviour using the XenForo config.php proxy option like this:
Code:
$config['proxyUrlFormat'] = 'proxy.php?{type}=https://images.weserv.nl/?url={url}';

Unfortunately, the way XF and weserv parse links is a bit different. XenForo will return this as result when reading the URL:
Code:
https://(forumURL)/proxy.php?image=https://images.weserv.nl/?url=http%3A%2F%2Fi.imgur.com%2FFLU5cl6.png

I'm hoping anyone can help without me having to setup a separate proxy server.

Thanks in advance!
 
I'm in the same situation. I have my forum behind Cloudflare to hide my origin via https and I'm using AWS SES to route outgoing email which effectively blocks my origin in the email headers. Now I need to come up with a solution to proxy images and/or block hotlinking to force everyone to upload their images directly to my site, otherwise, my origin IP is revealed in the http logs from where the image is fetched.

I see that Guzzle supports image proxy, but not sure how to get that working.

Does anyone have a solution?
 
I'm in the same situation. I have my forum behind Cloudflare to hide my origin via https and I'm using AWS SES to route outgoing email which effectively blocks my origin in the email headers. Now I need to come up with a solution to proxy images and/or block hotlinking to force everyone to upload their images directly to my site, otherwise, my origin IP is revealed in the http logs from where the image is fetched.

I see that Guzzle supports image proxy, but not sure how to get that working.

Does anyone have a solution?
Hi there,

I ended setting up tinyproxy on a VPS from OVH (+-2 eur per month). Great solution and so far haven't had any issues.

Feel free to message me if you need help.
 
To help others that stumble upon this post:

So yes, to verify, I followed this tutorial: https://xenforo.com/community/threa...xy-for-config-http-proxy.169192/#post-1371073

After that, I added the following to my config.php
Code:
$config['http']['proxy'] = 'tcp://1.1.1.1:8888';

I kept an eye on the TinyProxy log (/var/log/tinyproxy/tinyproxy.log) and used https://grabify.link/ in combination with an imgur image and the xenforo proxy testing tool (admin.php?tools/test-image-proxy) to verify the image is being proxied and the server IP is being hidden.
 
Top Bottom