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

It could be that my expectations are incorrect, but I assumed I'd see the following behavior after configuring an instance of Apache as a reverse proxy:

  • I hit server1:9089 which runs a reverse proxy rule to forward requests to Server8:80
  • My request is redirected to Server8:80 which serves content
  • My browser should show me that I'm still "sitting" on server1:80, not Server8:80

I'm not seeing this. After I am redirected, the hostname of the machine that I was directed to shows up in address bar of the browser. (and was visible in the status bar of the browser during the redirect)

I thought part of the "goodness" of a reverse proxy was that it hides the machine/machines doing the heavy lifting (Server8, in this case) from the user?

Here is what (I think) is the relevant part of my httpd.conf:

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
localhost:9089

#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other 
# <Directory> blocks below.
#
<Directory />
    AllowOverride none
    Require all denied
</Directory>

#####PROXY
ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass / http://server8/
ProxyPassReverse / http://server8/

Can anyone give me a feel for what I'm doing wrong here? Or do I not understand something more fundamental about what a reverse proxy can and can't do for me?

Thanks much!

share|improve this question
    
1st: redirect means to send the browser to a different url/server. proxy means to take the request, execute it in lieu of the requester and return the content to the requester. You seem to be mixing up the terms here because what you explain match what you get. But does not match your config. What is server8? you should include the config of server8. Perhaps you have something on server8 that redirects to a URL and includes the server's name in the redirect? You attribute "ServerName localhost:9089" is looking strange to me. Normally that would just be a name but that's not the issue here. –  ETL Apr 18 '13 at 20:37
    
Yeah, fat-fingered the server name and didn't even see that. Thanks. You nailed the issue. Server8 is a reporting platform, and IT redirects a call to / to a login page which uses the server8 name in the redirect. I think I assumed that the apache reverse proxy sitting on localhost:9089 would be able to deal with that and simply show localhost:9089/loginpage instead of server8/loginpage. Guess not? –  Russell Christopher Apr 18 '13 at 20:49

1 Answer 1

up vote 1 down vote accepted

The configuration shown here is correct. What is happening is the backend server does a redirect to a login page (according to further comments from OP) which uses the server's host name for the URL.

Without knowing which backend server technology is used, I can't say how to fix that but changing this behavior will solve the problem.

Apache's proxy won't change the redirect URL in this configuration.

share|improve this answer

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.