Welcome to WebmasterWorld Guest from 54.196.33.246

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

mod rewrite to proxy

     
6:29 pm on Oct 24, 2013 (gmt 0)

New User

joined:Oct 24, 2013
posts: 3
votes: 0


Hi, I'm new to mod_rewrite and I need to setup a proxy on my clients server.

What we need is to inspect the requested URL and proxy the request to outside server. The returned content should appear to the browser as coming from our domain.

The URL calls are dynamic and we don't to control the full URL only the domain and the first directory in the request. The rest will be dynamic.

example request:

https://www.mysite.com/videothumb/unsecured/media/1301119679001/23764.jpg?pubId=1301119679001

needs to proxy to:

http://www.othercomp.com/unsecured/media/1301119679001/23764.jpg?pubId=1301119679001


I need to catch and proxy any request that starts with this URL: [mysite.com...] while maintaining the rest of the path/file/params.

I tried to add this to the httpd-vhosts.conf at the end of the <VirtualHost> section with no luck


RewriteRule ^videothumb/(.*)$ http://www.othercomp.com/$1 [P]


Any ideas how to accomplish this?

Thank you for your help
7:59 pm on Oct 24, 2013 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14146
votes: 540


I tried to add this to the httpd-vhosts.conf at the end of the <VirtualHost> section with no luck

RewriteRule ^videothumb/

Is this rule inside a directory section? If not, it would need a leading slash. For insurance, try it without the opening anchor.

I'm assuming you have other RewriteRules in the same section, so the RewriteEngine is already on.

Does "no luck" mean that, as far as you can tell, nothing happened at all? Or did the wrong thing happen?
8:15 pm on Oct 24, 2013 (gmt 0)

New User

joined:Oct 24, 2013
posts: 3
votes: 0


Thank you for the reply, yes there are other rules before this one and working fine. By nothing happens, I mean the proxy is not taking place and the request results in 404.

You mean try it like this:


RewriteRule /videothumb/(.*)$ http://www.othercomp.com/$1 [P]
or
RewriteRule videothumb/(.*)$ http://www.othercomp.com/$1 [P]
4:00 am on Oct 25, 2013 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14146
votes: 540


A form with neither an anchor nor a slash will always work everywhere. So try that first. If pattern format isn't the problem, we'll dig deeper.

Can we also assume that mod_proxy is enabled? It would be a pretty embarrassing oversight-- but you wouldn't be the first!
12:16 pm on Oct 26, 2013 (gmt 0)

New User

joined:Oct 24, 2013
posts: 3
votes: 0


yes its is on :) first thing I confirmed.

RewriteEngine on


I tried


RewriteRule ^videothumb/(.*)$ http://www.othercomp.com/$1 [P]
RewriteRule /videothumb/(.*)$ http://www.othercomp.com/$1 [P]
RewriteRule videothumb/(.*)$ http://www.othercomp.com/$1 [P]


with no luck. Yes, I did restart apache after each change.

I'm not clear if I need ProxyPassReverse as well?
9:28 pm on Oct 26, 2013 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14146
votes: 540


While waiting for someone who speaks Apache:

Are you on 2.2 or 2.4? The present thread doesn't seem to say, and it may end up making a difference.

System

1:14 am on Oct 27, 2013 (gmt 0)

redhat

 
 


The following 4 messages were cut out to new thread by incredibill. New thread at: apache/4619305.htm [webmasterworld.com]
10:46 pm on Oct 26, 2013 (PST -8)
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members