Auto Configration Servers and Apache for proxy/URL redirecto

Discuss practical ways rearrange URLs using mod_rewrite.

Auto Configration Servers and Apache for proxy/URL redirecto

Postby mert361 » Sat Sep 06, 2008 9:05 am

Hi,

We are deploying a ACS server and apache 2.0.x proxy, while testing phase we needed to redirect Http1.1 Post requests coming from user's modems.

modems post URL = http://ServerIP:8181/cwmp/pmpACS
we need above to rewritten to = http://ServerIP:8181/cwmpWeb/CPEMgt

I wrote a 1 liner rule :

RewriteEngine On
RewriteRule ^/cwmp/pmpACS$ /cwmpWeb/CPEMgt

RewriteLog "/opt/apache/apache2.0/logs/rewrite.log"
RewriteLogLevel 5

However this don't seem to work, there isn't a single line of debug and none of the modems register with ACS, instead there are lots of "/cwmp/pmpACS" not found messages (404) in apache access logs.

Can you help me, am I missing something, i
mert361
 
Posts: 2
Joined: Sat Sep 06, 2008 8:51 am

Postby richardk » Sat Sep 06, 2008 11:29 am

Where are you putting the mod_rewrite?
Does this mod_rewrite test work?

Try the following in a .htaccess file in "ServerIP:8181/"
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^cwmp/pmpACS$ /cwmpWeb/CPEMgt [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby mert361 » Sat Sep 06, 2008 1:04 pm

We are not hosting on anything on machine so I have to put the code to httpd.conf. However 3 Virtual Hosts defined there too.

Code: Select all
LoadModule weblogic_module modules/mod_wl_20.so
LoadModule rewrite_module modules/mod_rewrite.so

Options +FollowSymLinks

RewriteEngine On

RewriteRule ^cwmp/pmpACS$ /cwmpWeb/CPEMgt [QSA,L]

RewriteLog "/opt/apache/apache2.0/logs/rewrite.log"
RewriteLogLevel 5

NameVirtualHost ServerIP:8010
NameVirtualHost ServerIP:8015
NameVirtualHost ServerIP:8181

<VirtualHost ServerIP:8010>
    DocumentRoot  "/opt/apache/apache2.0/htdocs"
    WLLogFile     /opt/apache/apache2.0/logs/global_proxy_1.log
    ErrorLog      /opt/apache/apache2.0/logs/error_8010.log
    TransferLog   /opt/apache/apache2.0/logs/access_8010.log
    <Location ~ /(cwmpWeb|hdm|remotehdm|cwmp|sce)>
        WebLogicHost ServerIP
        WebLogicPort 7003
        SetHandler weblogic-handler
        </Location>
        WLLogFile    /opt/apache/apache2.0/logs/access_1.log
</VirtualHost>

<VirtualHost ServerIP:8015>
        DocumentRoot  "/opt/apache/apache2.0/htdocs"
        WLLogFile     /opt/apache/apache2.0/logs/global_proxy_2.log
        ErrorLog      /opt/apache/apache2.0/logs/error_8015.log
        TransferLog   /opt/apache/apache2.0/logs/access_8015.log
        <Location ~ /(cwmpWeb|hdm|remotehdm|cwmp|sce)>
                WebLogicHost ServerIP
                WebLogicPort 7008
                SetHandler weblogic-handler
        </Location>
        WLLogFile    /opt/apache/apache2.0/logs/access_2.log
</VirtualHost>

<VirtualHost ServerIP:8181>
    DocumentRoot  "/opt/apache/apache2.0/htdocs"
    WLLogFile     /opt/apache/apache2.0/logs/global_proxy_3.log
    ErrorLog      /opt/apache/apache2.0/logs/error_8181.log
    TransferLog   /opt/apache/apache2.0/logs/access_8181.log
 
     Options +FollowSymLinks
    RewriteEngine On
    RewriteRule ^cwmp/pmpACS$ /cwmpWeb/CPEMgt [QSA,L]

    <Location ~ /(cwmpWeb|hdm|remotehdm|cwmp|sce)>
        WebLogicHost ServerIP
        WebLogicPort 7003
        SetHandler weblogic-handler
    </Location>
    WLLogFile    /opt/apache/apache2.0/logs/access_3.log
</VirtualHost>

mert361
 
Posts: 2
Joined: Sat Sep 06, 2008 8:51 am

Postby richardk » Mon Sep 08, 2008 11:42 am

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^/cwmp/pmpACS$ /cwmpWeb/CPEMgt [QSA,L]

in the 8181 <VirtualHost>, or
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{SERVER_PORT} ^8181$
RewriteRule ^cwmp/pmpACS$ /cwmpWeb/CPEMgt [QSA,L]

in /opt/apache/apache2.0/htdocs/.htaccess.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 7 guests

cron