logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Reverse Proxy issues on Apache
Author
micxba



Joined: 26 Aug 2013
Posts: 1
Location: USA

PostPosted: Mon 26 Aug '13 20:31    Post subject: Reverse Proxy issues on Apache Reply with quote

I feel like I read just about all the help that is out there when it comes to reverse proxying and HTTPD but it appears a lot is contradicting or not really working. Any help would be greatly appreciated.

We have a simple setup - Apache HTTPD in front of a few Tomcat servers.

The proxy should translate URL's like

http://domain.com/12345 -> http://internal:90/base/xhtml/user/55555555

My vhost is currently as follows:

Code:

 Servername domain.com
  ProxyRequests Off
 
  <Proxy balancer://b1>
    BalancerMember http://internal:90/ route=int1
  </Proxy>
 
  ProxyPreserveHost On
  RewriteEngine On
  RewriteRule ^/12345/(.*)   balancer://b1/base/xhtml/user/5555555/$1 [P]
  SetOutPutFilter proxy-html
  ProxyPass         /12345   balancer://b1/base/xhtml/user/5555555   stickysession=JSESSIONID|jsessionid nofailover=On
  ProxyPassReverse   /12345   balancer://b1/base/xhtml/user/5555555 


When I enter the external URL:
http://domain.com/12345 - I get redirected to http://domain.com/xhtml/user/55555555/login.xhtml

When I enter the external URL: http://domain.com/12345/login.xhmlt the form comes up but upon submit it redirects again to http://domain.com/xhtml/user/55555555/login.xhtml

Essentially I could get the site to work with the "long" URL but that is not desired as different scenarios will have to be satisfied down the road. I played with different variations but for some reason the destination app insists of going the /xhtml/user/..etc router.

Is there a way to force Apache to use the external URL? I tried getting it done with proxy_html_module but either I don't know what I am doing or it does not work either.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Tue 03 Sep '13 11:33    Post subject: Reply with quote

I wonder why you need the rewrite rule. Usually the ProxyPass and ProxyPassReverse should do it. I also wonder why you have a balancer with only one member ... maybe you just did not post the other members.

So without the rewrite rule

http://pastebin.com/raw.php?i=CqpucFLw

You have to enable mod proxy html

Code:
ProxyHTMLEnable On


Please consult http://httpd.apache.org/docs/current/mod/mod_proxy_html.html for the options.
Back to top


Reply to topic   Topic: Reverse Proxy issues on Apache View previous topic :: View next topic
Post new topic   Forum Index -> Apache