Hi,
I'm trying to do an external rewrite like :
http://example.com/example_url => http://other.server.com/http://example.com/example_url
The rewrite rule I have tried is :
RewriteRule .* http://other.server.com/http://%{SERVER_NAME}%{REQUEST_URI} [R,L]
but this just hangs. The error log shows :
I have tried other replacements in the RewriteRule directive which do not work (they just hang, and give similar error log messages to above).
RewriteRule .* http://other.server.com/?u=http://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteRule .* http://other.server.com/http://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteRule .* http://other.server.com%{REQUEST_URI} [R,L]
RewriteRule ^(.*)$ http://other.server.com/u=http://%{SERVER_NAME}$1 [R,L]
RewriteRule ^(.*)$ http://other.server.com/$1 [R,L]
These rules do work though :
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteRule .* http://%{SERVER_NAME}:8000%{REQUEST_URI} [R,L]
(where 8000 can be any valid port).
It appears that the problem might be when the redirected server name is statically defined rather than generated at runtime (though I'd need to test more scenarios to confirm that).
Note : these rules are input into the 'Rewrite' section at the virtual host level. I have not tried them in other contexts.
Note also : the error log entries (all log level 9) are identical to the one displayed above (except for the resulting URI), whether the external redirect is successful or not.
Litespeed version : 4.0.17 Standard.
Thanks for looking into this.
I'm trying to do an external rewrite like :
http://example.com/example_url => http://other.server.com/http://example.com/example_url
The rewrite rule I have tried is :
RewriteRule .* http://other.server.com/http://%{SERVER_NAME}%{REQUEST_URI} [R,L]
but this just hangs. The error log shows :
Code:
2010-11-23 13:07:18.104 [INFO] [127.0.0.1:55432-0#proxy-login-redirect] [REWRITE] Rule: Match '/test' with pattern '.*', result: 1
2010-11-23 13:07:18.104 [INFO] [127.0.0.1:55432-0#proxy-login-redirect] [REWRITE] Source URI: '/test' => Result URI: 'http://other.server.com/http://example.com/test'
2010-11-23 13:07:18.104 [INFO] [127.0.0.1:55432-0#proxy-login-redirect] [REWRITE] Last Rule, stop!
RewriteRule .* http://other.server.com/?u=http://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteRule .* http://other.server.com/http://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteRule .* http://other.server.com%{REQUEST_URI} [R,L]
RewriteRule ^(.*)$ http://other.server.com/u=http://%{SERVER_NAME}$1 [R,L]
RewriteRule ^(.*)$ http://other.server.com/$1 [R,L]
These rules do work though :
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteRule .* http://%{SERVER_NAME}:8000%{REQUEST_URI} [R,L]
(where 8000 can be any valid port).
It appears that the problem might be when the redirected server name is statically defined rather than generated at runtime (though I'd need to test more scenarios to confirm that).
Note : these rules are input into the 'Rewrite' section at the virtual host level. I have not tried them in other contexts.
Note also : the error log entries (all log level 9) are identical to the one displayed above (except for the resulting URI), whether the external redirect is successful or not.
Litespeed version : 4.0.17 Standard.
Thanks for looking into this.
Last edited by a moderator: