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/25 16:54:52 UTC

[users@httpd] Mod_proxy and javascript problem

Hello community.

I'm trying to set up a reverse proxy under apache 2.0.54 (debian version).

The server i'm proxy reversing is a IIS 6.0 with class server on it (a
microsoft application for school networking).

I'm using mod_security, rewriterules and proxy for the reverse proxy and some of
virtual hosting because I'm masking 3 IIS server behind a linux/apache
server.

Each server is reached as follow :

http://www.toto.net/ goes to server1 (1.0.2.1)
http://www.toto.net/class goes to server2 (1.0.0.2)
http://www.toto.net/prod goes to server3 (1.0.0.3)
http://www.toto.net/sst goes to stats on the apache server

The big problem is that some javascript (.js) are not correctly interpreted
on the browser, so the html page is broken.

My vhost looks like this :

<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>

        # 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]

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

        ProxyPassReverse /prod/         http://1.0.0.3/
        ProxyPassReverse /class/        http://1.0.0.2/
        ProxyPassReverse /              http://1.0.2.1/

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

Of course I'm limited in debugging because the class server application needs IE 6.0...

The Html source page is the same if I go directly to the server or if I go through the proxy
(BODY, HEAD and HTML tags have been commented out)

<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
<!-- _localBinding --><!-- _lcid="1036" _version="" -->

<script language="jscript" src="/CSInc/Admin/Admin.js"></script>

<!--HTML>
<!--HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>Microsoft Class Server - Page d'accueil de l'administrateur</TITLE>


</HEAD>
<!--BODY border=0 bordercolor=silver leftmargin=0 topmargin=0 rightmargin=0 bottommargin=0 class=clsTopFrameBody style="border:0px; margin:0px;">

<FORM action="StudentBrowse.htm" method="POST" id=HOME name=HOME>

<link rel="stylesheet" type="text/css" href="/CSInc/Admin/Admin.css">

<TABLE class="clsTable" style="color:white; width:100%; height=42pt" cellpadding=0 cellspacing=0>
	<TR style="background-color:#663333; height:8%;" cellpadding=0 cellspacing=0>
		<TD colspan="3" class="clsOperationTitleTD" style="vertical-align:middle;" >Administrateur Microsoft Class Server </TD>
		<td align=right style="font-weight:normal">
			<span style="color:#CC9999;" name=HOMEREF id=HOMEREF align=left ><B>Accueil</B></span>&nbsp | &nbsp
			<span class=clsSpanLink tabindex=1 name=LOGOFFREF id=LOGOFFREF m_strAction="Signout.htm" style="behavior:url(/CSInc/Admin/link.htc);" title="Cliquez pour quitter le site Web de l'administrateur sans fermer votre navigateur">Déconnexion</span>&nbsp | &nbsp
			<a tabindex=2 href="Help.htm" target="_search" title="Afficher l'aide en ligne"><B>Aide</B></a>&nbsp&nbsp
		</td>
	</TR>
	<TR style="color:#996666; height:12%;" cellpadding=0 cellspacing=0>
		<TD valign=bottom></TD>
	</TR>
	<TR style="line-height:0pt;">
		<TD>
			<TABLE WIDTH=250 BORDER=0 CELLSPACING=0 CELLPADDING=0>
				<TR style="line-height:0pt;">
					<TD>&nbsp</TD>
				</TR>
			</TABLE>
		</TD>
	</TR>
</TABLE>	
<TABLE style="color:blue; width:100%;height=40pt" cellpadding=0 cellspacing=0>
	<TR cellpadding=0 cellspacing=0>
		<TD>&nbsp</TD>
	</TR>
</TABLE>	

<TABLE style="color:blue; width:100%; font-size:9pt" cellpadding=0 cellspacing=0 border=0>
	<TR style="color:#663333; height: 26pt;" cellpadding=0 cellspacing=0>
		<TD width=20%>&nbsp</TD>
		<TD colspan=2 class="clsOperationTitleTD" style="vertical-align:middle;" > Les administrateurs peuvent ajouter ou modifier&nbsp;:</TD>
	</TR>
	<TR style="height:26pt;" cellpadding=0 cellspacing=0>
		<TD>&nbsp</TD>
		<td m_strAction="TeacherBrowse.htm" style="behavior:url(/CSInc/Admin/link.htc);" tabindex=3><span name=TREF id=TREF>&nbsp <LI><U><B>Informations sur les enseignants</U></B></span></LI></td>
		<TD width=40%>&nbsp</TD>
	</TR>
	<TR style="height:26pt;" cellpadding=0 cellspacing=0>
		<TD>&nbsp</TD>
		<td m_strAction="ClassBrowse.htm" style="behavior:url(/CSInc/Admin/link.htc);" tabindex=4><span name=CREF id=CREF>&nbsp <LI></LI><U><B>Informations sur les classes</U></B></span></td>
		<TD>&nbsp</TD>
	</TR>
	<TR style="height:26pt;" cellpadding=0 cellspacing=0>
		<TD>&nbsp</TD>
		<td m_strAction="StudentBrowse.htm" style="behavior:url(/CSInc/Admin/link.htc);" tabindex=5><span name=SREF id=SREF>&nbsp <LI></LI><U><B>Informations sur les élèves</U></B></span></td>
		<TD>&nbsp</TD>
	</TR>
	
	<TR style="height:26pt;" cellpadding="0" cellspacing="0">
		<TD>&nbsp</TD>
		<td colspan=2 m_strAction="School/Home.htm" style="behavior:url(/CSInc/Admin/link.htc);" tabindex="5"><span name="SREF" id="Span1">&nbsp <LI></LI><B><U>Page d'accueil de l'établissement</U></B></span></td>
	</TR>
	
</TABLE>	

<INPUT type="hidden" value='0' id=InList1Hid name=InList1Hid style="width:0px; height:0px; display:none">
	
</FORM>

<!--/BODY>
<!--/HTML>

What is not working are the following type of links :
- <td m_strAction="ClassBrowse.htm" style="behavior:url(/CSInc/Admin/link.htc);" tabindex=4><span name=CREF id=CREF>&nbsp <LI></LI><U><B>Informations sur les classes</U></B></span></td>
- <td m_strAction="StudentBrowse.htm" style="behavior:url(/CSInc/Admin/link.htc);" tabindex=5><span name=SREF id=SREF>&nbsp <LI></LI><U><B>Informations sur les élèves</U></B></span></td>

I can post the javascript but it's quite long (I will on users demands).

Anyway it's looks like mod_proxy cannot proxy correctly some javascript, maybe
someone can help me ?

thanks

PS: Please, forgive my bad english...
PS2: mod_security does not looks like to be the problem as desactivating it does not change anything


---------------------------------------------------------------------
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] Mod_proxy and javascript problem

Posted by Joshua Slive <js...@gmail.com>.
On 8/25/05, Jérôme Tytgat <je...@asterion.fr> wrote:
> Hello community.
> 
> I'm trying to set up a reverse proxy under apache 2.0.54 (debian version).
> 
> The server i'm proxy reversing is a IIS 6.0 with class server on it (a
> microsoft application for school networking).
> 
> I'm using mod_security, rewriterules and proxy for the reverse proxy and some of
> virtual hosting because I'm masking 3 IIS server behind a linux/apache
> server.
> 
> Each server is reached as follow :
> 
> http://www.toto.net/ goes to server1 (1.0.2.1)
> http://www.toto.net/class goes to server2 (1.0.0.2)
> http://www.toto.net/prod goes to server3 (1.0.0.3)
> http://www.toto.net/sst goes to stats on the apache server
> 
> The big problem is that some javascript (.js) are not correctly interpreted
> on the browser, so the html page is broken.

This is probably because the javascript contains links using the
private names/paths rather than the public ones.  You can fix this
with mod_proxy_html:
http://apache.webthing.com/mod_proxy_html/

Joshua.

---------------------------------------------------------------------
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