redirect - Mod_rewrite is not working in apache -


i have configured apache http webserver 2.2.29 proxy. it's function redirect incoming request backend server. below flow.

client sends request using url https://iproxy.company.co.uk:8443/cis1. apache instance listening on iproxy.company.co.uk:8443. request has sent backend server on url https://i.company.co.uk:8443. achieve have used mod_rewrite. below configured in httpd-alias.conf file.

   `listen iproxy.company.uk:8443 

    servername      iproxy.company.uk:8443      documentroot    /app/     rewriteengine on     rewriterule (.*)$ https://i.company.co.uk:8443$1 [r=301,l]     proxypassreverse "/products/widget/" "http://product.example.com/widget/"     rewritelog /app/instance1/logs/rewrite.log     rewriteloglevel 5      errorlog "/app/instance1/logs/error_log"     transferlog "/app/instance1//logs/access_log"      sslengine on     sslprotocol -sslv2 -sslv3     sslciphersuite high:!medium:!anull:!md5:!rc4     sslcertificatefile "/app/certificates/star.cer"     sslcertificatekeyfile "/app/certificates/star.key"     sslcertificatechainfile "/app/certificates/rootcachain.pem"     customlog "/app/instance1/logs/ssl_request_log" \       "%t %h %{ssl_protocol}x %{ssl_cipher}x \"%r\" %b"    </virtualhost>` 

i have configured rewrite loggin level 5. getting below in rewrite logs.

i hitting below command check if redirection works

curl -k https://iproxy.company.co.uk:8443/cis1

getting below output

<!doctype html public "-//ietf//dtd html 2.0//en"> <html><head> <title>301 moved permanently</title> </head><body> <h1>moved permanently</h1> <p>the document has moved <ahref="http://i.company.co.uk:8443/cis1">here</a>.</p> </body></html>

i can see below printed in rewrite logs.

redirect https://i.company.co.uk:8443/ci1 [redirect/301]

hence assuming redirection working fine. however.it not..as server not getting request? doing wrong in configuration.

update: have updated rewriterule directive adding [p] @ end, worked , issue got resolved.

rewriterule (.*)$ https://sit-alfresco.rpmi.co.uk:443$1 [p]

you sending 301 response browser make request.

this not acting proxy @ then!

does browser have access i.company.co.uk (in case why need proxy?) or accessible server (in case rewrite not work)?

if want proxy should use mod_proxy following config:

proxypass / https://i.company.co.uk:8443/ 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -