LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-07-2015, 12:32 PM   #1
jayhall
LQ Newbie
 
Registered: Dec 2011
Posts: 5

Rep: Reputation: Disabled
Apache RewriteRule


We are attempting to use our Apache 2.2.14 server as a passthrough proxy for some of our clients.

I need to redirect the URL http://our.server.com/stlouis to a server on another (remote) network.

Following is what I am attempting to use to rewrite the URL.

Code:
<IfModule rewrite_module>
        RewriteLog "/var/log/rewrite.log"
#       RewriteLogLevel 3
        RewriteEngine On
        RewriteRule https://our.server.com/stlouis http://remote.server.com/feed/aJrjesEeEU-lWKMOCwnaYw?take=6&league=NFL [P,QSA]
</IfModule>
My understanding is RewriteRule must be used because I do not want the query string to be encoded when it is sent to the remote server.

mod_rewrite and mod_proxy are loaded.


I am sure this is something simple I am overlooking.

Thank you in advance for your assistance and any suggestions are greatly appreciated.


Jay
 
Old 01-08-2015, 04:27 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,194
Blog Entries: 1

Rep: Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056
Quote:
My understanding is RewriteRule must be used because I do not want the query string to be encoded when it is sent to the remote server.
mod_rewrite and mod_proxy are loaded.
If I understand correctly what you're trying to do, then you should use the following:
Code:
RewriteRule /stlouis http://remote.server.com/feed/aJrjesEeEU-lWKMOCwnaYw?take=6&league=NFL [P,QSA]
Regards
 
Old 01-09-2015, 10:18 AM   #3
jayhall
LQ Newbie
 
Registered: Dec 2011
Posts: 5

Original Poster
Rep: Reputation: Disabled
We receive an error message, "The page /stlouis does not exist on this server," is displayed.

The proxy module is enabled.
Code:
<IfModule mod_proxy.c>
        ProxyRequests On
#
        <Proxy *>
                Order allow,deny
                Allow from all
        </Proxy>
        ProxyVia On

</IfModule>
Is the <IfModule> line correct to check for the proxy module being loaded? Or, should it read <IfModule proxy_http_module>?

Thank you,


Jay
 
Old 01-12-2015, 02:11 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,194
Blog Entries: 1

Rep: Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056
Your configuration is for a forward proxy which is not what you want.
If you're trying to use apache as a reverse proxy, you'll need something like:
Code:
ProxyPreserveHost On
ProxyRequests Off
ProxyPass /stlouis http://remote.server.com/feed/aJrjesEeEU-lWKMOCwnaYw
ProxyPassReverse /stlouis http://remote.server.com/feed/aJrjesEeEU-lWKMOCwnaYw
In this case the query string should be present in the original request, so it could be passed to the back-end server
 
Old 01-12-2015, 01:50 PM   #5
jayhall
LQ Newbie
 
Registered: Dec 2011
Posts: 5

Original Poster
Rep: Reputation: Disabled
If I use ProxyPass will the ? be replaced with %3F?

Thank you,


Jay
 
Old 01-13-2015, 02:02 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,194
Blog Entries: 1

Rep: Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056Reputation: 2056
Quote:
Originally Posted by jayhall View Post
If I use ProxyPass will the ? be replaced with %3F?

Thank you,


Jay
No it won't. The whole URI will be passed to the back-end server as-is
 
  


Reply

Tags
apache, mod_rewrite


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache RewriteRule help danster3k Linux - Server 3 10-06-2010 01:35 AM
Apache RewriteRule does not do what I want? Ujjain Linux - Server 0 03-26-2009 07:46 AM
Rewriterule problems apache 2.2.4 qwqg Linux - Server 7 03-21-2008 04:20 AM
Apache rewriterule mesh2005 Linux - Server 1 08-03-2007 02:23 AM
Help w/ Apache htaccess (RewriteRule) bhuwan Programming 1 03-16-2006 06:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration