www.sitename/gallery instead of hostname/gallery

skaffen

Joined: 2002-09-06
Posts: 6
Posted: Fri, 2002-09-06 14:53

OK, got gallery working, but there's one problem: Our campus network has private IP
adresses and we have a firewall as a proxy for incoming requests to our webserver. I don't know what the major problem is but I cannot access the default page from outside the private network. I searched the archive for problems relating to hostname but couldn't find anything.

When I set it up and I access the site under:

http://www.sitename/gallery

it automatically gets rewritten in the browser as

http://hostname/gallery

when I access it from inside the campus. From outside the campus it fails to connect since hostname cannot be accessed.

I set up the albums with the site-option it works, so from outside the network I can
acess

www.sitename/gallery/albumname

but not the frontpage www.sitename/gallery

Any help appreciated,

Andreas

 
vallimar

Joined: 2002-08-15
Posts: 487
Posted: Sat, 2002-09-07 04:24

Thats odd, do you have the mod_rewrite stuff enabled?
If so, try disable it in the gallery/.htaccess file and see if the problem
still occurs. Also, double check config.php to make sure the urls are
specified properly there. If all of those check out okay, then it sounds
like it may be a problem with the webserver configuration itself.

 
TheWatcher
TheWatcher's picture

Joined: 2002-08-21
Posts: 120
Posted: Sat, 2002-09-07 07:08
Quote:
OK, got gallery working, but there's one problem: Our campus network has private IP
adresses and we have a firewall as a proxy for incoming requests to our webserver. I don't know what the major problem is but I cannot access the default page from outside the private network. I searched the archive for problems relating to hostname but couldn't find anything.

When I set it up and I access the site under:

http://www.sitename/gallery

it automatically gets rewritten in the browser as

http://hostname/gallery

when I access it from inside the campus. From outside the campus it fails to connect since hostname cannot be accessed.

I set up the albums with the site-option it works, so from outside the network I can
acess

www.sitename/gallery/albumname

but not the frontpage www.sitename/gallery

Any help appreciated,

Andreas

What is the exact error when you access www.sitename/gallery ???

Can you please provide the diagnostics.php page also.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sat, 2002-09-07 21:01

The problem is that Gallery (for a variety of technical reasons) needs the full URL to your Gallery. But, you actually have two URLs, one for inside your private network and one for outside. There is no one url that works correctly in both cases, right?

The solution is to modify init.php. Configure your Gallery to use the external URL (www.fullservername.com/gallery) and then we'll tweak the code to have it
"fix" the url if you're using it internally. It may take us a couple of iterations to get this exactly correct.

For this example, let's make the following assumptions:
1. "hostname" is the internal name of the server
2. "1.1.1.1" is the internal IP address of the server
3. "www.site.com" is the external address of the server

Edit init.php and right above the "set_magic_quotes_runtime" block, add the following code:

if (stristr($HTTP_SERVER_VARS['SERVER_ADDR'], '1.1.1.1')) {
$gallery->app->photoAlbumURL =
eregi_replace('www.site.com', 'hostname',
$gallery->app->photoAlbumURL);
$gallery->app->albumDirURL =
eregi_replace('www.site.com', 'hostname',
$gallery->app->albumDirURL);
}

This basically says "if we got to the server on the internal address, pretend that we entered the internal hostname in the config wizard". Good luck.

 
skaffen

Joined: 2002-09-06
Posts: 6
Posted: Sun, 2002-09-08 07:51

Problem solved, see below.

Quote:
The problem is that Gallery (for a variety of technical reasons) needs the full URL to your Gallery. But, you actually have two URLs, one for inside your private network and one for outside. There is no one url that works correctly in both cases, right?

No, not really, the www.sitename works from the internal network but those URLs are changed in the browser to the hostname after accessing them.

URLs to albums were correct (since I gave them in the config file) but not to the starting page.

I now know the problem, we recently got a different setup with the firewall (which is not administerd by me but by the comp center) to not only let connections through but to also act as a proxy. Before that the IP-adress/hostname worked from everywhere. Took me two hours of fiddling with redirects and links last night (thank god I finally got my DSL flatrate so that I could play at this from home :wink: ) before it finally hit me:

In my httpd.conf I had given the ServerName as the hostname in my VirtualHost section which always worked and never caused problems with any other page after the change of firewall configuration.

This is the first case it did, so after setting the ServerName to www.sitename things are working perfectly! Yeah! Now I have to talk the boss into forking out some money for a faster server since the aging P160 is ok for serving pages but a tad bit slow at resizing the pics. Since he just got a digital camera, this might just work out! :wink:

Thank you for all the help,

Andreas