2

I'm creating a Facebook client for a very limited device - its web browser (ANT Galio) does not handle properly HTTP302 for source of images.

My UC looks like this - in web application markup profile images are placed in the manner:

<img src="http://reverseproxyfqdn/graph.facebook.com/profileId/picture/" />

When proxy asks for graph.facebook.com/profileId/picture/ it gets HTTP 302 redirect to different address, for example fbcdn-profile-a.akamaihd.net/someUrl. This response is reverse proxied to web browser with Location header changed to reverseproxyfqdn/fbcdn-profile-a.akamaihd.net/someUrl. All the web browsers I've tested handle it properly, but not ANT Galio. I need to return image got from fbcdn-profile-a.akamaihd.net/someUrl directly as a response to reverseproxyfqdn/graph.facebook.com/profileId/picture/ - so do not expose the whole HTTP 302 redirect story to the web browser.

Does anyone know how to do it in Nginx or Apache 2.2? I would like to avoid creating a special PHP/Perl/Java app for this and achieve it by HTTP server configuration.

2 Answers 2

2

You should consider the proxy_redirect directive which might help you dealing with this problem.

3
  • I'm using this directive but this is not what I want. I do not want HTTP server to respond to the browser with modified HTTP 302 (this is what proxy_redirect@nginx or PrxyReverse@Apache does). I want it to send a file which is in Location header.
    – Daniel
    Mar 15, 2012 at 17:41
  • Okay, I understood what you want to do. Apparently this is not possible. Nginx is not designed to be used as a forward proxy like Squid (e.g proxy acts as a HTTP client), but only as a reverse proxy.
    – mishka
    Mar 17, 2012 at 15:12
  • However I am curious to know (and I expect) if there is a trick to bypass this problem.
    – mishka
    Mar 17, 2012 at 15:19
1

Don't send the graph.facebook.com/.../picture/... URLs to the browser in the first place. Instead, resolve them yourself on the server side while you're creating the HTML pages and insert the CDN URLs in their place.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .