httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rael <>
Subject [users@httpd] Apache with mod_rewrite and mod_proxy doesn't work / P Flag
Date Tue, 05 Apr 2016 11:01:42 GMT

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, 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 ^$


For example with "RewriteRule ^$" the user gets
a http redirection from e.g. http://localhost to
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 '' -> '
    split uri= ->
      uri=, args=p=111:3
    [perdir /var/www/html/] implicitly forcing redirect (rc=302) with
    [perdir /var/www/html/] escaping
      /apex/f?p=111:3 for redirect
    [perdir /var/www/html/] escaping p=111:3 to query string for redirect
    [perdir /var/www/html/] redirect to
      /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 '' -> '
    uri= ->
      uri=, args=p=111:3
    [perdir /var/www/html/] escaped URI in per-dir context for proxy, ->
    [perdir /var/www/html/] forcing proxy-throughput with
    [perdir /var/www/html/] go-ahead with proxy request 
      proxy: [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:
For additional commands, e-mail:

View raw message