You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Christopher Bianchi <ch...@tactek.com> on 2008/03/04 21:53:49 UTC

[users@httpd] Apache Behind Proxy Trailing Slash Issue

Hi, folks.

I'm new to the list, but I've been working with Apache for some years and
have been through most configurations and upgrades.

I'm running into a specific problem right now and need some guidance.

As you know, trailing slashes are required for directories and when it is
omitted from a request, Apache performs a redirect to include the trailing
slash. This is fine and I understand the necessity.

The problem is that I have Apache (2.0.63) running behind a firewall on
port 8080. Squid (2.6b18) is the proxy running on port 80.

When Apache receives a directory request without a trailing slash, its
redirect includes its running port (e.g. http://myserver/dir is redirected
to http://myserver:8080/dir/). 8080 is user inaccessible and the redirect
fails.

How do I prevent Apache from affixing the port into the URL redirect? Does
Apache need to know that it's running behind a reverse proxy?

Thank you!
Chris

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache Behind Proxy Trailing Slash Issue

Posted by Christopher Bianchi <ch...@tactek.com>.
Thanks for the response, Joshua.

Unfortunately, that didn't do the trick. When I appended the :80 to the
ServerName directive, I simply got "Cannot find server" messages when
attempting to access http://myserver/dir (no trailing slash).

I may have to move to using a separate Apache server to handle these
requests, however I'm a bit concerned due to the number of virtual hosts
operating on this server.

Chris


On Tue, March 4, 2008 4:02 pm, Joshua Slive wrote:
> On Tue, Mar 4, 2008 at 3:53 PM, Christopher Bianchi <ch...@tactek.com>
> wrote:
>
>>  The problem is that I have Apache (2.0.63) running behind a firewall on
>>  port 8080. Squid (2.6b18) is the proxy running on port 80.
>>
>>  When Apache receives a directory request without a trailing slash, its
>>  redirect includes its running port (e.g. http://myserver/dir is
>> redirected
>>  to http://myserver:8080/dir/). 8080 is user inaccessible and the
>> redirect
>>  fails.
>>
>>  How do I prevent Apache from affixing the port into the URL redirect?
>> Does
>>  Apache need to know that it's running behind a reverse proxy?
>
> Normally the proxy is responsible for fixing this up (as the apache
> proxy will do with the ProxyPassReverse directive). I'd guess squid
> could do it with the right config.
>
> But you can get apache to lie about its own name and port using something
> like
> ServerName myserver:80
> UseCanonicalName On
>
> Joshua.
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache Behind Proxy Trailing Slash Issue

Posted by Joshua Slive <jo...@slive.ca>.
On Tue, Mar 4, 2008 at 3:53 PM, Christopher Bianchi <ch...@tactek.com> wrote:

>  The problem is that I have Apache (2.0.63) running behind a firewall on
>  port 8080. Squid (2.6b18) is the proxy running on port 80.
>
>  When Apache receives a directory request without a trailing slash, its
>  redirect includes its running port (e.g. http://myserver/dir is redirected
>  to http://myserver:8080/dir/). 8080 is user inaccessible and the redirect
>  fails.
>
>  How do I prevent Apache from affixing the port into the URL redirect? Does
>  Apache need to know that it's running behind a reverse proxy?

Normally the proxy is responsible for fixing this up (as the apache
proxy will do with the ProxyPassReverse directive). I'd guess squid
could do it with the right config.

But you can get apache to lie about its own name and port using something like
ServerName myserver:80
UseCanonicalName On

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache Behind Proxy Trailing Slash Issue

Posted by Nick Kew <ni...@webthing.com>.
On 4 Mar 2008, at 20:53, Christopher Bianchi wrote:
>
> How do I prevent Apache from affixing the port into the URL  
> redirect? Does
> Apache need to know that it's running behind a reverse proxy?

The proxy should be in charge of this.  If the proxy were Apache, we  
could
tell you how ( http://www.apachetutor.org/admin/reverseproxies ).  I  
believe
squid can fix headers, but I haven't heard of it having the  
capability to
filter contents.

On Apache, you could use mod_headers (Header edit) to fixup outgoing
headers.  You'll need mod_headers from 2.2 to do that, but AFAIK it's
source-compatible with 2.0.

-- 
Nick Kew

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org