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: Need help with reverse proxy
Author
TomBodet



Joined: 27 Aug 2012
Posts: 1

PostPosted: Mon 27 Aug '12 16:57    Post subject: Need help with reverse proxy Reply with quote

I've tried the example on apachetutor (http://www.apachetutor.org/admin/reverseproxies) as it seemed like exactly what I wanted but it's not quite working.

What I have is a single DNS entry that I want to then put multiple websites behind. So for example:

DNS = help.mydomain.com

All this code is inside a VirtualHost block:
Code:
<VirtualHost *:443>
  ServerName help.mydomain.com


I have a tomcat server that I've mapped to a single app successfully because it's using the same URL:

Code:
ProxyPreserveHost on
ProxyPass /app1 https://10.10.1.2:8443/app1
ProxyPassReverse /app1 https://10.10.1.2:8443/app1


The above works like a champ because the /app1 is literally there on both sides. What I now need is an uneven match. So based on the tutor example I then tried a proxy for a standard webpage that the server hosts at the root level, but want to proxy it by another sub url:

Code:

ProxyHTMLExtended On
ProxyRequests Off
ProxyPass /app2 https://10.10.1.50
ProxyHTMLURLMap https://10.10.1.50 /app2

<Location /app2>
        ProxyPassReverse /
        ProxyHTMLEnable On
        ProxyHTMLURLMap  /      /app2
        RequestHeader    unset  Accept-Encoding
</Location>


When I go to help.mydomain.com/app2 it manages to see the initial page enough to redirect to the home.html page. But the address bar gives me:

Quote:
help.mydomain.com/home.html


When I'm expecting:

Quote:
help.mydomain.com/app2/login.html


If I put the /app2 in there it finds enough to have the next forward to work (meaning you hit home unauthenticated so it directs you to the logon script then to a login page, etc...) but each time it goes to pull the new page the URL keeps dropping the app2 portion.

How do I fix this? I've tried a redirect call but depending on security settings, that gets caught by the user's browser but then it's also a non-routable IP so I realized it won't work anyway.

Thanks for your time.
Back to top
James Blond
Moderator


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

PostPosted: Sat 22 Sep '12 23:22    Post subject: Reply with quote

From the tutorial you missed the trailing slash at the end

ProxyPass /app2 https://10.10.1.50/

Maybe also helpful from Version 2.1, mod_proxy_html supports a ProxyHTMLLogVerbose directive, to enable verbose logging at LogLevel Info.
When verbose logging is enabled, the following messages will be logged:

  • In Charset Detection, it will report what charset is detected and how (HTTP rules, XML rules, or HTML rules). Note that, regardless of verbose logging, an error or warning will be logged if an unsupported charset is detected or if no information can be found.
  • When ProxyHTMLMeta is enabled, it logs each header/value pair processed.
  • Whenever a ProxyHTMLURLMap rule matches and causes a rewrite, it is logged. The message contains abbreviated context information: H denotes an HTML link matched; E denotes a match in a scripting event, C denotes a match in an inline script or stylesheet. When the match is a regexp find-and-replace, it is also marked as RX.
Back to top


Reply to topic   Topic: Need help with reverse proxy View previous topic :: View next topic
Post new topic   Forum Index -> Apache