You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Bart Braem <ba...@gmail.com> on 2006/03/05 11:41:23 UTC

[users@httpd] Redirecting urls to a server on a different port

Hello,

Is it possible to redirect requests on a certain url to a local server on a
different port? Something like www.somewhere.com/something to
localhost:8080 and www.somewhere.com/something/extended/version to
localhost:8080/extended/version.
I can't use virtual hosting there, how about url rewriting?

Bart


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Redirecting urls to a server on a different port

Posted by victor <vi...@ambra.ro>.
Try RedirectMatch instead Redirect.
You can find all the necesary docs here: 
http://httpd.apache.org/docs/1.3/mod/mod_alias.html#redirectmatch.


Bart Braem wrote:

>victor wrote:
>
>  
>
>>Try sometring like this
>>Redirect /index.php http://localhost:8081
>>I use it with virtual host.
>>index.php is a file from the docroot of that virtual host.
>>    
>>
>
>That seems a nice solution but how can I make it work for an unlimited
>number of files? Should I use regular expressions then?
>
>Thanks for your fast reply!
>
>
>---------------------------------------------------------------------
>The official User-To-User support forum of the Apache HTTP Server Project.
>See <URL:http://httpd.apache.org/userslist.html> for more info.
>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>For additional commands, e-mail: users-help@httpd.apache.org
>
>
>  
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: Redirecting urls to a server on a different port

Posted by Bart Braem <ba...@gmail.com>.
victor wrote:

> Try sometring like this
> Redirect /index.php http://localhost:8081
> I use it with virtual host.
> index.php is a file from the docroot of that virtual host.

That seems a nice solution but how can I make it work for an unlimited
number of files? Should I use regular expressions then?

Thanks for your fast reply!


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Redirecting urls to a server on a different port

Posted by victor <vi...@ambra.ro>.
Try sometring like this
Redirect /index.php http://localhost:8081
I use it with virtual host.
index.php is a file from the docroot of that virtual host.


Bart Braem wrote:

>Hello,
>
>Is it possible to redirect requests on a certain url to a local server on a
>different port? Something like www.somewhere.com/something to
>localhost:8080 and www.somewhere.com/something/extended/version to
>localhost:8080/extended/version.
>I can't use virtual hosting there, how about url rewriting?
>
>Bart
>
>
>---------------------------------------------------------------------
>The official User-To-User support forum of the Apache HTTP Server Project.
>See <URL:http://httpd.apache.org/userslist.html> for more info.
>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>For additional commands, e-mail: users-help@httpd.apache.org
>
>
>  
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: Re: Redirecting urls to a server on a different port

Posted by Bart Braem <ba...@gmail.com>.
Dick Middleton wrote:

> Bart,
>>>Have a look at mod_proxy
> 
>> I already did, it seems to work only with subdomains. Or am I mistaken
>> there? I can't find good information on not using subdomains as it's
>> difficult to search for...
> 
> No.  Reverse proxy is more like an alias where a particular URL is
> mapped onto another URL.
> 
> ProxyPass /cam/camel http://horse.com/
> ProxyPassReverse /cam/camel http://horse.com/
> 
> would change a request like:
> 
> http://yourdomain.com/cam/camel/subdir/index.html
> 
> to effectively:
> 
> http://horse.com/subdir/index.html
> 
> The main difference between a redirect and a reverse proxy is the client
> does not know with a proxy that the request is served from a different
> URL.  With a redirect the user can see they have been switched to the
> other site.
> 
This is exactly what I needed, thanks!

Bart


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Redirecting urls to a server on a different port

Posted by Dick Middleton <di...@lingbrae.com>.
Bart,
>>Have a look at mod_proxy

> I already did, it seems to work only with subdomains. Or am I mistaken
> there? I can't find good information on not using subdomains as it's
> difficult to search for...

No.  Reverse proxy is more like an alias where a particular URL is 
mapped onto another URL.

ProxyPass /cam/camel http://horse.com/
ProxyPassReverse /cam/camel http://horse.com/

would change a request like:

http://yourdomain.com/cam/camel/subdir/index.html

to effectively:

http://horse.com/subdir/index.html

The main difference between a redirect and a reverse proxy is the client 
does not know with a proxy that the request is served from a different 
URL.  With a redirect the user can see they have been switched to the 
other site.

Dick

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: Redirecting urls to a server on a different port

Posted by Bart Braem <ba...@gmail.com>.
Dick Middleton wrote:

> Bart Braem wrote:
> 
>> Is it possible to redirect requests on a certain url to a local server on
>> a different port? Something like www.somewhere.com/something to
>> localhost:8080 and www.somewhere.com/something/extended/version to
>> localhost:8080/extended/version.
> 
> Have a look at mod_proxy
> 

I already did, it seems to work only with subdomains. Or am I mistaken
there? I can't find good information on not using subdomains as it's
difficult to search for...

Thanks for your fast reply!


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Redirecting urls to a server on a different port

Posted by Dick Middleton <di...@lingbrae.com>.
Bart Braem wrote:

> Is it possible to redirect requests on a certain url to a local server on a
> different port? Something like www.somewhere.com/something to
> localhost:8080 and www.somewhere.com/something/extended/version to
> localhost:8080/extended/version.

Have a look at mod_proxy

Dick



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org