mod_rewrite behind reverse proxy

Hi,

I'm installing zenphoto behind an apache reverse proxy (http://www.mysite.com/photos/ -> http://internalzphoto/).

After tweaking the following settings I got it working.

define('WEBPATH', '/photos');
$_SERVER['HTTP_HOST']='www.mysite.com';

Now I am trying to use mod_rewrite for nicer URLs using the stock .htaccess with RewriteBase / (any other value gives an HTTP error 500 as the web server gets into an infinite loop).

However the rewrites are failing in a strange way :

http://www.mysite.com/photos/01234567890123456789/ gives :

The Zenphoto object you are requesting cannot be found.
Album: 7890123456789

Somehow the album name gets truncated.

Whereas http://www.mysite.com/photos/123456/ works and display the album as expected. However then accessing an image within that album fails :

http://www.mysite.com/photos/123456/IMG_4233.JPG.php gives:

The Zenphoto object you are requesting cannot be found.
Album: 123456/IMG_4233.JPG.php

I have enabled mod_rewrite debugging but must admit being rather clueless about what to make out of the logs or what to try now. Help would be much appreciated.

Comments

  • I am not at all clear as to what you have done with the reverse proxy. But if you run the setup program using the URL you wish to have visitors use it should set everything correctly.

    given the information above the rewrite base should be `/photos`.

    Do note that it is not possible to use mod_rewrite if there is more than one URI pointing to your installation. Rewrite rules allow for only one base.
  • pgauret Member
    Thanks for your quick reply which put me on the right way to make it work.

    My "internal" zenphoto was at http://zenphoto/ I changed it to be http://zenphoto/photos/ , set RewriteBase to /photos and it now works perfectly.

    Let me know if you are interested in a more detailed writeup of how to run zenphoto behind a reverse proxy.
  • acrylian Administrator, Developer
    I personally have no use for such an information right now but others surely might have. I would suggest to post instructions on your site that we can link to from our user guide or maybe it would be better suited in one of the extensions category (we'll see). You can do here but your site is probably better to update and better to be found by others probably.
Sign In or Register to comment.