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: rewriterule does redirect rather than proxy
Author
Rotor



Joined: 28 Oct 2014
Posts: 9
Location: France,lyon

PostPosted: Tue 28 Oct '14 16:30    Post subject: rewriterule does redirect rather than proxy Reply with quote

Hello,
I just installed httpd-2.4.10-win32 and I can't make mod_rewrite to work :
What I'd want is a proxy to receive a print.xxxx.com/appl uri and forwards to appl.serveur.xxxx.com:8080/streammaster
I do
RewriteCond %{HTTP_HOST} print.xxxx.com
RewriteRule /appl/ http://appl.serveur.xxxx.com:8080/streammaster [P]

and I get a redirect : 192.168.250.50 - - [28/Oct/2014:14:55:19 +0100] "GET /appl/ HTTP/1.1" 302 -
mod_proxy is loaded and works of course.
I've tried lot of variations (it works the same in a virtual host without rewritecond) to no avail. I must be doing something wrong but what?
Thanks!
Back to top
James Blond
Moderator


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

PostPosted: Tue 28 Oct '14 17:17    Post subject: Reply with quote

You should use a reverse proxy inside your vhost instead the rewrite rule


<VirtualHost *:80>
ServerName print.xxxx.com
DocumentRoot "/mario/Apache22/htdocs"
<Directory "/mario/Apache22/htdocs">
Options Indexes Includes FollowSymLinks
AllowOverride None
Require All granted
</Directory>
<Location /appl/>
ProxyPass http://appl.serveur.xxxx.com:8080/streammaster/
ProxyPassReverse http://appl.serveur.xxxx.com:8080/streammaster/
</Location>
</virtualhost>
Back to top
Rotor



Joined: 28 Oct 2014
Posts: 9
Location: France,lyon

PostPosted: Tue 28 Oct '14 18:06    Post subject: Reply with quote

Thanks but now I get the "redirection loop" (below).
There's really a problem with this specific "surgery" and I begin to think that it can't be done with a "classical" proxy configuration.
192.168.250.50 - - [28/Oct/2014:17:02:05 +0100] "GET /esi// HTTP/1.1" 302 -
192.168.250.50 - - [28/Oct/2014:17:02:05 +0100] "GET /esi// HTTP/1.1" 302 -
192.168.250.50 - - [28/Oct/2014:17:02:05 +0100] "GET /esi// HTTP/1.1" 302 -
192.168.250.50 - - [28/Oct/2014:17:02:05 +0100] "GET /esi// HTTP/1.1" 302 -
192.168.250.50 - - [28/Oct/2014:17:02:05 +0100] "GET /esi// HTTP/1.1" 302 -
192.168.250.50 - - [28/Oct/2014:17:02:05 +0100] "GET /esi// HTTP/1.1" 302 -
192.168.250.50 - - [28/Oct/2014:17:02:05 +0100] "GET /esi// HTTP/1.1" 302 -
192.168.250.50 - - [28/Oct/2014:17:02:05 +0100] "GET /esi// HTTP/1.1" 302 -
192.168.250.50 - - [28/Oct/2014:17:02:05 +0100] "GET /esi// HTTP/1.1" 302 -
192.168.250.50 - - [28/Oct/2014:17:02:05 +0100] "GET /esi// HTTP/1.1" 302 -
192.168.250.50 - - [28/Oct/2014:17:02:05 +0100] "GET /esi// HTTP/1.1" 302 -
Back to top
Rotor



Joined: 28 Oct 2014
Posts: 9
Location: France,lyon

PostPosted: Wed 29 Oct '14 12:20    Post subject: Reply with quote

Ooops, in fact your solution worked but there was a second problem because of links in the page. Thanks again for the quick help!
Back to top
jraute



Joined: 13 Sep 2013
Posts: 188
Location: Rheinland, Germany

PostPosted: Wed 29 Oct '14 14:20    Post subject: Reply with quote

Did you use mod_proxy_html?

"This module provides an output filter to rewrite HTML links in a proxy situation, to ensure that links work for users outside the proxy. It serves the same purpose as Apache's ProxyPassReverse directive does for HTTP headers, and is an essential component of a reverse proxy." (see also http://httpd.apache.org/docs/current/mod/mod_proxy_html.html)
Back to top


Reply to topic   Topic: rewriterule does redirect rather than proxy View previous topic :: View next topic
Post new topic   Forum Index -> Apache