Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've read through the documentation for nginx's HttpProxyModule, but I can't figure this out:

I want it so that if someone visits, for example http://ss.example.com/1339850978, nginx will proxy them http://dl.dropbox.com/u/xxxxx/screenshots/1339850978.png.

If I was to just use this line in my config file:
proxy_pass http://dl.dropbox.com/u/xxxxx/screenshots/;, then they would have to append the .png themselves.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You could combine proxy_pass with a rewrite directive:

rewrite /([^/]+) /$1.png break;
proxy_pass http://dl.dropbox.com/u/xxxxx/screenshots/;
share|improve this answer
1  
This didn't quite work but after some experimentation I found this was fine: rewrite /(.*) /u/70152/screenshots/$1.png break; proxy_pass http://dl.dropbox.com/; –  David Robertson Jun 16 '12 at 14:27
    
@DavidRobertson, I am sorry it did not work. will try to fix it as soon as I can get to test the rules. Thank you for the points. –  Dmitri Chubarov Jun 16 '12 at 14:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.