Rewriting of ports to which users are redirected

Discuss practical ways rearrange URLs using mod_rewrite.

Postby Guest » Fri Sep 07, 2001 8:43 am

Hello all,
I have a following problem:
T he cluster runs www servcie on port 80, but the real servers run apache on port 82 (the cluster's port 80 is redirected to the real servers' port 82). The apache does some rewriting, ending with Location: http://cluster.name.cz:82/something/ , but I need to redirect users to http://cluster.name.cz/something/ (ie. port 80 instead of 82, but not via http://cluster.name.cz:80/something/).

Is there anyone who can tell me how to achieve this?

I've read standard documentation for mod_rewrite and URL Rewriting Guide, but I haven't been able to find a solution... :sad:

Thanks for any help or hint...

Petr
Guest
 

Postby antonio_danger » Sun Sep 09, 2001 8:58 pm

Hi there,

I think you want to redirect a URL
http://www.something.com/path to
a backend server running at port 82 .

you can even achieve this by a
ProxyPass Directive from mod_proxy .

you proxy the request from port 80 to
port 82 and serve the request back
as http://www.something.com.

I have tried using the rewrite module
<IfModule mod_rewrite.c>

RewriteLog "/usr/local/apache/logs/rewrite.log"
RewriteLogLevel 9
RewriteRule ^(.*) %{HTTP_HOST}$1 [C]
RewriteRule ^www.something.com/(.*) http://www.something.com:82/$1 [R]

</IfModule>

This is not a correct prox mechanism.

There is another way to achieve it using
the Virtual Host Entry as in
http://perl.apache.org/guide/scenario.html

cheers,
tony
antonio_danger
 
Posts: 1
Joined: Sun Sep 09, 2001 4:00 pm

Postby orin » Mon Sep 10, 2001 1:24 am

Sorry, that's not the case. :sad:

The rewriting of cluster.name.something:80 to real.server.cz:82 is done via Alteon switches, that means that request to apache are directed to port 82. And when there is some redirection via Location: header, it is directed to cluster.name.something:82.
What I want to achieve is the Location: header without the port 82, so that users send their new request to cluster.name.something (on port 80).

But anyway, thanks for reply... :wink:
Petr
orin
 
Posts: 1
Joined: Thu Sep 06, 2001 4:00 pm

Postby Brett » Mon Oct 15, 2001 7:37 am

Hi Petr,

I haven't tried the following, but they might help:

I think you can check the server port in a rewrite condition:
RewriteCond ${SERVER_PORT} ^82$

I think you can specify the server port in a rewrite rule:
RewriteRule ^(.*) $1 [env=SERVER_PORT:80]


<font size=-1>[ This Message was edited by: Brett on 2001-10-15 11:37 ]</font>
Brett
 
Posts: 82
Joined: Tue Jul 10, 2001 4:00 pm
Location: yohost.com


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 4 guests

cron