You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jérôme Tytgat <je...@asterion.fr> on 2005/08/26 09:34:23 UTC

[users@httpd] Proxyerroroverride and "302" errors

Hello,

I've some problem implementing ProxyErrorOverride.

It does not work correctly with "302" (moved) errors.

In fact each first access time, the 302 error is printed instead of
redirecting the browser on the right page.

Any clue ?

I really don't like sql server and IIS server errors being printed...

I'm working on Apache 2.0.54 on a debian linux.

Thanks.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Proxyerroroverride and "302" errors

Posted by Jérôme Tytgat <je...@asterion.fr>.
This problem has been solved by a rewriterule.

Thanks.

Jérôme Tytgat a écrit :
> 
> Nick Kew a écrit :
> 
>>Jérôme Tytgat wrote:
>>
>> > the "&nbsp" are transformed in "&amp;nbsp"
>>
>>no, the ampersand is entified.  If you validated, you'd see that
>>"&nbsp" means something very different from "&nbsp;", which is what
>>you meant.  
> 
> 
>>Technically it's a browser bug if your browser doesn't
>>display the "&nbsp" as the characters "&", "n", etc.
> 
> 
> You are right and that's why it's not interpreted by the browser.
> 
> In one case (without Proxy_Html) I get "&nbsp" in the other case
> I get "&amp;nbsp".
> 
> IE interpret them of course... but when they are rewritten by the proxy
> IE does not understand them anymore.
> 
> As the the application needs IE6 for working and is developped by MS, it works
> for IE6.
> 
> Is there any method of rewriting "&amp;nbsp" or "&nbsp" in "&nsbp;" ?
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Proxyerroroverride and "302" errors

Posted by Jérôme Tytgat <je...@asterion.fr>.

Nick Kew a écrit :
> Jérôme Tytgat wrote:
> 
>  > the "&nbsp" are transformed in "&amp;nbsp"
> 
> no, the ampersand is entified.  If you validated, you'd see that
> "&nbsp" means something very different from "&nbsp;", which is what
> you meant.  

> Technically it's a browser bug if your browser doesn't
> display the "&nbsp" as the characters "&", "n", etc.

You are right and that's why it's not interpreted by the browser.

In one case (without Proxy_Html) I get "&nbsp" in the other case
I get "&amp;nbsp".

IE interpret them of course... but when they are rewritten by the proxy
IE does not understand them anymore.

As the the application needs IE6 for working and is developped by MS, it works
for IE6.

Is there any method of rewriting "&amp;nbsp" or "&nbsp" in "&nsbp;" ?


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Proxyerroroverride and "302" errors

Posted by Jérôme Tytgat <je...@asterion.fr>.
even after enabling mod_headers and mod_proxy_html I still get the problem
on Firefox.

This what I see before I do a refresh on the browser :

f4
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Object Moved</title>
</head><body>
<h1>Object Moved</h1>
<p>The document has moved <a href="https://www.sevea.net/class/LYCEESEVEA/School/">here</a>.</p>
</body></html>

0

HTTP/1.1 200 OK
Date: Fri, 26 Aug 2005 08:48:09 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 6.0.2.6361
X-AspNet-Version: 1.1.4322
Pragma: no-cache
Set-Cookie: MSCSUserDomain=none; path=/
Cache-Control: no-cache
Expires: -1
Content-Type: text/html;charset=utf-8
Transfer-Encoding: chunked

1f41
<html><head>...

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Proxyerroroverride and "302" errors

Posted by Nick Kew <ni...@webthing.com>.
Jérôme Tytgat wrote:

 > the "&nbsp" are transformed in "&amp;nbsp"

no, the ampersand is entified.  If you validated, you'd see that
"&nbsp" means something very different from "&nbsp;", which is what
you meant.  Technically it's a browser bug if your browser doesn't
display the "&nbsp" as the characters "&", "n", etc.

As regards using mod_proxy_html, using rules for "/" with Extended
mapping on needs a lot of care.  Read the manual, and use the verbose
logging to see what it's doing.

-- 
Nick Kew

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Proxyerroroverride and "302" errors

Posted by Jérôme Tytgat <je...@asterion.fr>.
I repost the vhost accordingly to some modification, proxyerroroverride
is still problematic under firefox

<VirtualHost *:443>
        SSLEngine On
        SSLProxyEngine on
        SSLCACertificateFile /etc/apache2/ssl/cacert.pem
        #SSLCertificateFile /etc/apache2/ssl/www.sevea.net.crt
        #SSLCertificateKeyFile /etc/apache2/ssl/www.sevea.net.key
        SSLCertificateFile /etc/apache2/ssl/newcert.pem
        SSLCertificateKeyFile /etc/apache2/ssl/private.key

        ServerAdmin webmaster@sevea.net
        ServerName www.sevea.net
        ServerAlias sevea.net

        CustomLog /var/log/apache2/https.sevea.net.log combined
        ErrorLog /var/log/apache2/https.sevea.net.error.log

        RewriteEngine on
        RewriteOptions inherit
        RewriteLog "/var/log/apache2/rewrite.https.sevea.net.log"
        RewriteLogLevel 0

        ProxyRequests off
        ProxyVia Off
        ProxyErrorOverride On
        ProxyPreserveHost Off
        <Proxy *>
                Order Deny,Allow
                Allow from all
        </Proxy>

        <Location "/prod/">
            ProxyPassReverse http://192.168.0.3/
            RequestHeader        unset  Accept-Encoding
        </Location>
        <Location "/class/">
            ProxyPassReverse http://192.168.0.2/
            RequestHeader        unset  Accept-Encoding
        </Location>
        <Location "/">
            ProxyPassReverse http://192.168.2.1/
            RequestHeader        unset  Accept-Encoding
        </Location>

        #Stats

        Alias /sst/awstats-icon/ /usr/share/awstats/icon/
        ScriptAlias /sst/cgi-bin/ /usr/lib/cgi-bin/
        #ScriptAlias /sst/cgi-bin/ /usr/lib/cgi-bin/plouf/
        Alias /sst/     /usr/share/awstats/
        <Location "/sst/">
                SecFilterEngine Off
                Options None
                AllowOverride None
                Order Deny,Allow
                Allow from all
                AuthName "Statistiques www.sevea.net"
                AuthType Digest
                AuthDigestFile /var/www/plouf/.htpasswd-digest
                require valid-user
        </Location>

        <Directory /var/lib/awstats>
                Options None
                AllowOverride None
                Order Deny,Allow
        </Directory>
        <Directory /usr/share/awstats>
                Options None
                AllowOverride None
                Order Deny,Allow
        </Directory>

        # RewriteRules

        RewriteRule ^/sst$              https://www.sevea.net/sst/awstats.www.sevea.net.html [R,NC]
        RewriteRule ^/sst/$             https://www.sevea.net/sst/awstats.www.sevea.net.html [R,NC]

        RewriteRule ^/class$            https://www.sevea.net/class/ [R,NC]
        RewriteRule ^/class/class(.*)$  https://www.sevea.net/class$1 [R,NC]
        RewriteRule ^/CSInc(.*)$  	https://www.sevea.net/class/CSInc$1 [R,NC]

        RewriteRule ^/prod$             https://www.sevea.net/prod/ [R,NC]
        RewriteRule ^/prod/prod(.*)$    https://www.sevea.net/prod$1 [R,NC]

        RewriteCond %{HTTP_REFERER}     ^https://(www\.)?sevea.net/class/.*$ [NC]
        RewriteCond %{REQUEST_URI}      !^/class/.*$ [NC]
        RewriteRule ^/(.*)$             https://www.sevea.net/class/$1 [R]

        RewriteCond %{HTTP_REFERER}     ^https://(www\.)?sevea.net/prod/.*$ [NC]
        RewriteCond %{REQUEST_URI}      !^/prod/.*$ [NC]
        RewriteRule ^/(.*)$             https://www.sevea.net/prod/$1 [R]

        RewriteRule ^/prod/(.*)$        http://192.168.0.3/$1 [P,L,NC]
        RewriteRule ^/class/(.*)$       http://192.168.0.2/$1 [P,L,NC]
        RewriteRule ^/sevealoc/(.*)$   https://192.168.2.1/sevealoc/$1 [P,L,NC]

        RewriteCond %{REQUEST_URI}      !^/sst/.*$ [NC]
        RewriteRule ^/(.*)$             http://192.168.2.1/$1 [P,L]

        SecAuditLog /var/log/apache2/audit.https.sevea.net.log
</VirtualHost>

Jérôme Tytgat a écrit :
>>Since when is 302 an error?
> 
> 
> Since it's interpreted as it ?
> 
> Anyway, the problem occurs WHEN and only WHEN I use ProxyErrorOverride
> 
> 
>>You may need a proxyPassReverse directive.  See
>>http://www.apacheweek.com/features/reverseproxies
>>
> 
> 
> I use it... elsewhere my reverse proxy would not at all :
> 
> <VirtualHost *:443>
>         SSLEngine On
>         SSLProxyEngine on
>         SSLCACertificateFile /etc/apache2/ssl/cacert.pem
>         #SSLCertificateFile /etc/apache2/ssl/www.toto.net.crt
>         #SSLCertificateKeyFile /etc/apache2/ssl/www.toto.net.key
>         SSLCertificateFile /etc/apache2/ssl/newcert.pem
>         SSLCertificateKeyFile /etc/apache2/ssl/private.key
> 
>         ServerAdmin webmaster@toto.net
>         ServerName www.toto.net
>         ServerAlias toto.net
> 
>         CustomLog /var/log/apache2/https.toto.net.log combined
>         ErrorLog /var/log/apache2/https.toto.net.error.log
> 
>         RewriteEngine on
>         RewriteOptions inherit
>         RewriteLog "/var/log/apache2/rewrite.https.toto.net.log"
>         RewriteLogLevel 0
> 
>         ProxyRequests off
>         ProxyVia Off
>         ProxyErrorOverride Off
>         ProxyPreserveHost Off
>         <Proxy *>
>                 Order Deny,Allow
>                 Allow from all
>         </Proxy>
> 
>         #ProxyPass /prod/ http://1.0.0.3/
>         #ProxyPass /class/ http://1.0.0.2/
>         ProxyHTMLURLMap http://1.0.0.2 /class
>         ProxyHTMLURLMap http://1.0.0.3 /prod
> 
>         <Location "/prod/">
>             ProxyPassReverse http://1.0.0.3/
>             SetOutputFilter      proxy-html
>             ProxyHTMLURLMap / /prod/
>             ProxyHTMLURLMap /prod /prod
>         </Location>
>         <Location "/class/">
>             ProxyPassReverse http://1.0.0.2/
>             SetOutputFilter      proxy-html
>             ProxyHTMLURLMap / /class/
>             ProxyHTMLURLMap /class /class
>         </Location>
>         <Location "/">
>         #    ProxyPass http://1.0.2.1/
>             ProxyPassReverse http://1.0.2.1/
>         </Location>
> 
> 
>         #Stats
> 
>         Alias /sst/stats-icon/ /usr/share/stats/icon/
>         ScriptAlias /sst/cgi-bin/ /usr/lib/cgi-bin/
>         #ScriptAlias /sst/cgi-bin/ /usr/lib/cgi-bin/plouf/
>         Alias /sst/     /usr/share/stats/
>         <Location "/sst/">
>                 SecFilterEngine Off
>                 Options None
>                 AllowOverride None
>                 Order Deny,Allow
>                 Allow from all
>                 AuthName "Statistiques www.toto.net"
>                 AuthType Digest
>                 AuthDigestFile /var/www/plouf/.htpasswd-digest
>                 require valid-user
>         </Location>
> 
>         <Directory /var/lib/stats>
>                 Options None
>                 AllowOverride None
>                 Order Deny,Allow
>         </Directory>
>         <Directory /usr/share/stats>
>                 Options None
>                 AllowOverride None
>                 Order Deny,Allow
>         </Directory>
> 
>         # RewriteRules
> 
>         RewriteRule ^/sst$              https://www.toto.net/sst/stats.html [R,NC]
>         RewriteRule ^/sst/$             https://www.toto.net/sst/stats.html [R,NC]
> 
>         RewriteRule ^/class$            https://www.toto.net/class/ [R,NC]
>         RewriteRule ^/class/class(.*)$  https://www.toto.net/class$1 [R,NC]
> 
>         RewriteRule ^/prod$             https://www.toto.net/prod/ [R,NC]
>         RewriteRule ^/prod/prod(.*)$    https://www.toto.net/prod$1 [R,NC]
> 
>         RewriteCond %{HTTP_REFERER}     ^https://(www\.)?toto.net/class/.*$ [NC]
>         RewriteCond %{REQUEST_URI}      !^/class/.*$ [NC]
>         RewriteRule ^/(.*)$             https://www.toto.net/class/$1 [R]
> 
>         RewriteCond %{HTTP_REFERER}     ^https://(www\.)?toto.net/prod/.*$ [NC]
>         RewriteCond %{REQUEST_URI}      !^/prod/.*$ [NC]
>         RewriteRule ^/(.*)$             https://www.toto.net/prod/$1 [R]
> 
>         RewriteRule ^/prod/(.*)$        http://1.0.0.3/$1 [P,L,NC]
>         RewriteRule ^/class/(.*)$       http://1.0.0.2/$1 [P,L,NC]
>         RewriteRule ^/totoloc/(.*)$   https://1.0.2.1/totoloc/$1 [P,L,NC]
> 
>         RewriteCond %{REQUEST_URI}      !^/sst/.*$ [NC]
>         RewriteRule ^/(.*)$             http://1.0.2.1/$1 [P,L]
> 
>         #ProxyPassReverse /prod/         http://1.0.0.3/
>         #ProxyPassReverse /class/        http://1.0.0.2/
>         #ProxyPassReverse /totoloc/    https://1.0.2.1/totoloc/
>         #ProxyPassReverse /              http://1.0.2.1/
> 
>         SecAuditLog /var/log/apache2/audit.https.toto.net.log
> </VirtualHost>
> 
> Thanks.
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Proxyerroroverride and "302" errors

Posted by Jérôme Tytgat <je...@asterion.fr>.
> 
> Since when is 302 an error?

Since it's interpreted as it ?

Anyway, the problem occurs WHEN and only WHEN I use ProxyErrorOverride

> 
> You may need a proxyPassReverse directive.  See
> http://www.apacheweek.com/features/reverseproxies
> 

I use it... elsewhere my reverse proxy would not at all :

<VirtualHost *:443>
        SSLEngine On
        SSLProxyEngine on
        SSLCACertificateFile /etc/apache2/ssl/cacert.pem
        #SSLCertificateFile /etc/apache2/ssl/www.toto.net.crt
        #SSLCertificateKeyFile /etc/apache2/ssl/www.toto.net.key
        SSLCertificateFile /etc/apache2/ssl/newcert.pem
        SSLCertificateKeyFile /etc/apache2/ssl/private.key

        ServerAdmin webmaster@toto.net
        ServerName www.toto.net
        ServerAlias toto.net

        CustomLog /var/log/apache2/https.toto.net.log combined
        ErrorLog /var/log/apache2/https.toto.net.error.log

        RewriteEngine on
        RewriteOptions inherit
        RewriteLog "/var/log/apache2/rewrite.https.toto.net.log"
        RewriteLogLevel 0

        ProxyRequests off
        ProxyVia Off
        ProxyErrorOverride Off
        ProxyPreserveHost Off
        <Proxy *>
                Order Deny,Allow
                Allow from all
        </Proxy>

        #ProxyPass /prod/ http://1.0.0.3/
        #ProxyPass /class/ http://1.0.0.2/
        ProxyHTMLURLMap http://1.0.0.2 /class
        ProxyHTMLURLMap http://1.0.0.3 /prod

        <Location "/prod/">
            ProxyPassReverse http://1.0.0.3/
            SetOutputFilter      proxy-html
            ProxyHTMLURLMap / /prod/
            ProxyHTMLURLMap /prod /prod
        </Location>
        <Location "/class/">
            ProxyPassReverse http://1.0.0.2/
            SetOutputFilter      proxy-html
            ProxyHTMLURLMap / /class/
            ProxyHTMLURLMap /class /class
        </Location>
        <Location "/">
        #    ProxyPass http://1.0.2.1/
            ProxyPassReverse http://1.0.2.1/
        </Location>


        #Stats

        Alias /sst/stats-icon/ /usr/share/stats/icon/
        ScriptAlias /sst/cgi-bin/ /usr/lib/cgi-bin/
        #ScriptAlias /sst/cgi-bin/ /usr/lib/cgi-bin/plouf/
        Alias /sst/     /usr/share/stats/
        <Location "/sst/">
                SecFilterEngine Off
                Options None
                AllowOverride None
                Order Deny,Allow
                Allow from all
                AuthName "Statistiques www.toto.net"
                AuthType Digest
                AuthDigestFile /var/www/plouf/.htpasswd-digest
                require valid-user
        </Location>

        <Directory /var/lib/stats>
                Options None
                AllowOverride None
                Order Deny,Allow
        </Directory>
        <Directory /usr/share/stats>
                Options None
                AllowOverride None
                Order Deny,Allow
        </Directory>

        # RewriteRules

        RewriteRule ^/sst$              https://www.toto.net/sst/stats.html [R,NC]
        RewriteRule ^/sst/$             https://www.toto.net/sst/stats.html [R,NC]

        RewriteRule ^/class$            https://www.toto.net/class/ [R,NC]
        RewriteRule ^/class/class(.*)$  https://www.toto.net/class$1 [R,NC]

        RewriteRule ^/prod$             https://www.toto.net/prod/ [R,NC]
        RewriteRule ^/prod/prod(.*)$    https://www.toto.net/prod$1 [R,NC]

        RewriteCond %{HTTP_REFERER}     ^https://(www\.)?toto.net/class/.*$ [NC]
        RewriteCond %{REQUEST_URI}      !^/class/.*$ [NC]
        RewriteRule ^/(.*)$             https://www.toto.net/class/$1 [R]

        RewriteCond %{HTTP_REFERER}     ^https://(www\.)?toto.net/prod/.*$ [NC]
        RewriteCond %{REQUEST_URI}      !^/prod/.*$ [NC]
        RewriteRule ^/(.*)$             https://www.toto.net/prod/$1 [R]

        RewriteRule ^/prod/(.*)$        http://1.0.0.3/$1 [P,L,NC]
        RewriteRule ^/class/(.*)$       http://1.0.0.2/$1 [P,L,NC]
        RewriteRule ^/totoloc/(.*)$   https://1.0.2.1/totoloc/$1 [P,L,NC]

        RewriteCond %{REQUEST_URI}      !^/sst/.*$ [NC]
        RewriteRule ^/(.*)$             http://1.0.2.1/$1 [P,L]

        #ProxyPassReverse /prod/         http://1.0.0.3/
        #ProxyPassReverse /class/        http://1.0.0.2/
        #ProxyPassReverse /totoloc/    https://1.0.2.1/totoloc/
        #ProxyPassReverse /              http://1.0.2.1/

        SecAuditLog /var/log/apache2/audit.https.toto.net.log
</VirtualHost>

Thanks.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Proxyerroroverride and "302" errors

Posted by Nick Kew <ni...@webthing.com>.
Jérôme Tytgat wrote:
> Hello,
> 
> I've some problem implementing ProxyErrorOverride.
> 
> It does not work correctly with "302" (moved) errors.

Since when is 302 an error?

> In fact each first access time, the 302 error is printed instead of
> redirecting the browser on the right page.
> 
> Any clue ?

You may need a proxyPassReverse directive.  See
http://www.apacheweek.com/features/reverseproxies

-- 
Nick Kew

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org