OOPS, sorry, posted too fast. According to logs RewriteRule does not
perform internal redirect. You might try ProxyPass instead.
--
With Best Regards,
Marat Khalili
On 05/04/16 16:17, Marat Khalili wrote:
You also need ProxyPassReverse in
order to rewrite header URLs from the backend, and probably
ProxyPassReverseCookieDomain and ProxyPassReverseCookiePath too.
--
With Best Regards,
Marat Khalili
On 05/04/16 14:01, Rael wrote:
Hello,
I'm in the process to use Apache as a reverse proxy with mod_rewrite to have nicer URLs for an APEX-application.
The user shouldn't never see the actual URLs from app1.example.com:8888/apex..., that's why I use mod_proxy too.
Alas, it doesn't work.
Current settings in default vhost:
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
### Rewrite Rules ###
RewriteEngine On
LogLevel alert rewrite:trace6
RewriteRule ^$ http://app1.example.com:8888/apex/f?p=111:3
#####################
</Directory>
For example with "RewriteRule ^$ http://app1.example.com:8888/apex/f?p=111:3" the user gets a http redirection from e.g. http://localhost to http://app1.example.com:8888/apex/f?p=111:3 and then he also sees this last URL in his browser, which I don't want.
Infos from the log when I sent a request with the previous rewrite rule:
[perdir /var/www/html/] strip per-dir prefix: /var/www/html/ ->
[perdir /var/www/html/] applying pattern '^$' to uri ''
[perdir /var/www/html/] rewrite '' -> 'http://app1.example.com:8888
/apex/f?p=111:3'
split uri=http://app1.example.com:8888/apex/f?p=111:3 ->
uri=http://app1.example.com:8888/apex/f, args=p=111:3
[perdir /var/www/html/] implicitly forcing redirect (rc=302) with
http://app1.example.com:8888/apex/f
[perdir /var/www/html/] escaping http://app1.example.com:8888
/apex/f?p=111:3 for redirect
[perdir /var/www/html/] escaping p=111:3 to query string for redirect
p=111:3
[perdir /var/www/html/] redirect to http://app1.example.com:8888
/apex/f?p=111:3 [REDIRECT/302]
Adding the flag [P] to the RewriteRule, as far as I see it, should bring the desired behavior, but doesn't. I just get the index page from apache.
>From the logs, with [P] flag added to the previous rule:
[perdir /var/www/html/] strip per-dir prefix: /var/www/html/ ->
[perdir /var/www/html/] applying pattern '^$' to uri ''
[perdir /var/www/html/] rewrite '' -> 'http://app1.example.com:8888
/apex/f?p=111:3'
uri=http://app1.example.com:8888/apex/f?p=111:3 ->
uri=http://app1.example.com:8888/apex/f, args=p=111:3
[perdir /var/www/html/] escaped URI in per-dir context for proxy,
http://app1.example.com:8888/apex/f -> http://app1.example.com:8888
/apex/f
[perdir /var/www/html/] forcing proxy-throughput with
http://app1.example.com:8888/apex/f
[perdir /var/www/html/] go-ahead with proxy request
proxy:http://app1.example.com:8888/apex/f?p=111:3 [OK]
[perdir /var/www/html/] strip per-dir prefix: /var/www
/html/index.html -> index.html
[perdir /var/www/html/] applying pattern '^$' to uri 'index.html'
[perdir /var/www/html/] pass through /var/www/html/index.html
OS: Ubuntu 14.04 Apache(with mod_rewrite and mod_proxy enabled): 2.4.7
Thank you!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
|