Reverse Proxy with mod_proxy_html to IIS

Reverse Proxy with mod_proxy_html to IIS

am 28.11.2007 12:50:07 von marc

Hello!

I have nearly got this working but i am now completly stumped. I am
attempting to create a reverse proxy so a request is handled by
apache, and passed to the appropriate iis site, then caches the
response. I have it working ok for all but one site we use, whereby
the index pages checks if the browser is IE and if so loads a
different stylesheet:




mod_proxy_html consistently ignores this line and never loads ie.css.
In a gecko based browser the website is fine. My virtual host set up
(put together from various websites and groups) is below. Can anyone
offer any help?

Thanks

Marc

#proxyhtml setup
ProxyHTMLExtended On
ProxyHTMLMeta On
ProxyHTMLStripComments Off
ProxyBadHeader StartBody
ProxyHTMLLogVerbose On
ProxyHTMLCharsetDefault UTF-8
ProxyHTMLCharsetOut UTF-8
ProxyHTMLCharsetAlias ISO-8859-1 Windows-1252


ServerName mysite.co.uk
ServerAlias mysite.co.uk

#pass the proxy about
ProxyPass / http://localhost:8080/mysite/
ProxyPassReverse / http://localhost:8080/mysite/
ProxyHTMLURLMap http://localhost:8080/mysite/ /
ProxyHTMLURLMap http://localhost:8080/mysite/ http://mysite.co.uk/

ProxyHTMLURLMap url\(http://localhost:8080/mysite/([^\)]*)\)
url(http://mysite.co.uk/$1) Rihe

#do some caching
CacheRoot "C:\\program files\\Apache Software Foundation\\Apache2.2\
\cache\\mysite.co.uk\\"
CacheEnable disk /
CacheDirLevels 5
CacheDirLength 3
CacheMaxExpire 360

RequestHeader unset Accept-Encoding


Deny from all

Re: Reverse Proxy with mod_proxy_html to IIS

am 28.11.2007 18:42:14 von HansH

"Marc" schreef in bericht
news:c7dcb157-3bab-4ed4-bd64-3449e2b0d159@e1g2000hsh.googleg roups.com...
> I have nearly got this working but i am now completly stumped. I am
> attempting to create a reverse proxy so a request is handled by
> apache, and passed to the appropriate iis site, then caches the
> response. I have it working ok for all but one site we use, whereby
> the index pages checks if the browser is IE and if so loads a
> different stylesheet:
>
>
>
>
> mod_proxy_html consistently ignores this line
> and never loads ie.css.
Lost you here.

It's only a MS browser that will attempt to load the additional css, never
'just' mod_proxy.html itself. However, mod_proxy_html may forget to modify
the link and the browser is then likely to request with an incorrect path;
a 404 is most likely logged.

> In a gecko based browser the website is fine.
Because that browser takes the for a the _comment_ and thus
ignores the .
The site is made to show up fine without the additional css, BUT for MS
browsers.

You might have to learn the module to look for an URL to be modified inside
a comment too:
http://apache.webthing.com/svn/apache/filters/proxy_html/pro xy_html.conf
ProxyHTMLLinks !-- href
or perhaps even
ProxyHTMLLinks "!--[if IE]>

Just 2 ct

HansH

Re: Reverse Proxy with mod_proxy_html to IIS

am 29.11.2007 10:08:22 von marc

On 28 Nov, 17:42, "HansH" wrote:
> "Marc" schreef in berichtnews:c7dcb157-3bab-4ed4-bd64-3449e2b0d159@e1g2000hsh. googlegroups.com...> I have nearly got this working but i am now completly stumped. I am
> > attempting to create a reverse proxy so a request is handled by
> > apache, and passed to the appropriate iis site, then caches the
> > response. I have it working ok for all but one site we use, whereby
> > the index pages checks if the browser is IE and if so loads a
> > different stylesheet:
>
> >
>
> > mod_proxy_html consistently ignores this line
> > and never loads ie.css.
>
> Lost you here.
>
> It's only a MS browser that will attempt to load the additional css, never
> 'just' mod_proxy.html itself. However, mod_proxy_html may forget to modify
> the link and the browser is then likely to request with an incorrect path;
> a 404 is most likely logged.
>
> > In a gecko based browser the website is fine.
>
> Because that browser takes the for a the _comment_ and thus
> ignores the .
> The site is made to show up fine without the additional css, BUT for MS
> browsers.
>
> You might have to learn the module to look for an URL to be modified inside
> a comment too:http://apache.webthing.com/svn/apache/filters/proxy_html /proxy_html.conf
> ProxyHTMLLinks !-- href
> or perhaps even
> ProxyHTMLLinks "!--[if IE]> >
> Just 2 ct
>
> HansH

Hi - thanks for your response!

The only reason that a put "ignores the line" is that i would still
have expected the



line to show up in the markup for the page even if ie.css is not
actually loaded due to the wrong path, but it never appears - almost
like the browser is always assuming that it isnt IE.

I have attempted to add your suggestions to proxy_html.conf with no
success so i will see if i can read about about that.

Any other suggestions?

Thanks!

Marc

Re: Reverse Proxy with mod_proxy_html to IIS

am 29.11.2007 11:13:43 von marc

On 28 Nov, 17:42, "HansH" wrote:
> "Marc" schreef in berichtnews:c7dcb157-3bab-4ed4-bd64-3449e2b0d159@e1g2000hsh. googlegroups.com...> I have nearly got this working but i am now completly stumped. I am
> > attempting to create a reverse proxy so a request is handled by
> > apache, and passed to the appropriate iis site, then caches the
> > response. I have it working ok for all but one site we use, whereby
> > the index pages checks if the browser is IE and if so loads a
> > different stylesheet:
>
> >
>
> > mod_proxy_html consistently ignores this line
> > and never loads ie.css.
>
> Lost you here.
>
> It's only a MS browser that will attempt to load the additional css, never
> 'just' mod_proxy.html itself. However, mod_proxy_html may forget to modify
> the link and the browser is then likely to request with an incorrect path;
> a 404 is most likely logged.
>
> > In a gecko based browser the website is fine.
>
> Because that browser takes the for a the _comment_ and thus
> ignores the .
> The site is made to show up fine without the additional css, BUT for MS
> browsers.
>
> You might have to learn the module to look for an URL to be modified inside
> a comment too:http://apache.webthing.com/svn/apache/filters/proxy_html /proxy_html.conf
> ProxyHTMLLinks !-- href
> or perhaps even
> ProxyHTMLLinks "!--[if IE]> >
> Just 2 ct
>
> HansH

I have also installed Fiddler to debug the http request and at the [!--
if IE] statement never seems to resolve to true as ie.css is
definately never loaded.

Re: Reverse Proxy with mod_proxy_html to IIS

am 29.11.2007 11:45:31 von HansH

"Marc" schreef in bericht
news:8975eac8-8fc2-4be6-a2b8-107a5375446d@e23g2000prf.google groups.com...
>> >
>>
>> > mod_proxy_html consistently ignores this line
>> > and never loads ie.css.
>
> The only reason that a put "ignores the line" is that i would still
> have expected the
>
>
>
> line to show up in the markup for the page even if ie.css is not
> actually loaded due to the wrong path, but it never appears - almost
> like the browser is always assuming that it isnt IE.
The content of the comment indeed should be there regardless brand, type or
version of the browser used. If it is not, don't wonder why the file is
never requested ...

Do not rely on the source shown by any browser. Instead use p.e. telnet or
Perl-LWP's GET to request the 'raw' page directly from ISS and via Apache.
Ensure the comment is there both times.

If the comment does not pass the proxy, double check some config settings:
give multiple occurrances of ProxyHTMLStripComments some special attention.
(Be aware of INCLUDED config files and .htaccess)


HansH

Re: Reverse Proxy with mod_proxy_html to IIS

am 29.11.2007 13:56:21 von marc

On 29 Nov, 10:45, "HansH" wrote:
> "Marc" schreef in berichtnews:8975eac8-8fc2-4be6-a2b8-107a5375446d@e23g2000prf .googlegroups.com...>> >
>
> >> > mod_proxy_html consistently ignores this line
> >> > and never loads ie.css.
>
> > The only reason that a put "ignores the line" is that i would still
> > have expected the
>
> >
>
> > line to show up in the markup for the page even if ie.css is not
> > actually loaded due to the wrong path, but it never appears - almost
> > like the browser is always assuming that it isnt IE.
>
> The content of the comment indeed should be there regardless brand, type or
> version of the browser used. If it is not, don't wonder why the file is
> never requested ...
>
> Do not rely on the source shown by any browser. Instead use p.e. telnet or
> Perl-LWP's GET to request the 'raw' page directly from ISS and via Apache.
> Ensure the comment is there both times.
>
> If the comment does not pass the proxy, double check some config settings:
> give multiple occurrances of ProxyHTMLStripComments some special attention.
> (Be aware of INCLUDED config files and .htaccess)
>
> HansH

Solved! Replace [!-- if IE] with [! If IE] and it makes all the
difference. Now just to get on with javascript errors.

Thanks for your help.

Marc

Re: Reverse Proxy with mod_proxy_html to IIS

am 30.11.2007 00:19:04 von HansH

"Marc" schreef in bericht
news:ed71d8d5-a0cf-4ed8-a299-81e0f0e4685d@v4g2000hsf.googleg roups.com...
> On 29 Nov, 10:45, "HansH" wrote:
>> "Marc" schreef in
>> berichtnews:8975eac8-8fc2-4be6-a2b8-107a5375446d@e23g2000prf .googlegroups.com...>
>> Do not rely on the source shown by any browser. Instead use p.e. telnet
>> or
>> Perl-LWP's GET to request the 'raw' page directly from ISS and via
>> Apache.
>> Ensure the comment is there both times.
>>
>> If the comment does not pass the proxy, double check some config
>> settings:
>> give multiple occurrances of ProxyHTMLStripComments some special
>> attention.
>> (Be aware of INCLUDED config files and .htaccess)
>>
>> HansH
>
> Solved! Replace [!-- if IE] with [! If IE] and it makes all the
> difference.
Not pleased to hear you solved the issue by twisting a bend tag....
Do try to locate that wondering 'ProxyHTMLStripComments On'

> Now just to get on with javascript errors.
Are _commented_ inline scripts dropped?
That's the same 'ProxyHTMLStripComments On' .



Function alike 'window.open(...) ' might be a nasty nit to pick.

Need to tweek event triggers? Check ist is listed with ProxyHTMLEvents.

HansH

Re: Reverse Proxy with mod_proxy_html to IIS

am 30.11.2007 10:41:30 von marc

On 29 Nov, 23:19, "HansH" wrote:
> "Marc" schreef in berichtnews:ed71d8d5-a0cf-4ed8-a299-81e0f0e4685d@v4g2000hsf. googlegroups.com...
>
> > On 29 Nov, 10:45, "HansH" wrote:
> >> "Marc" schreef in
> >> berichtnews:8975eac8-8fc2-4be6-a2b8-107a5375446d@e23g2000prf .googlegroups.com...>
> >> Do not rely on the source shown by any browser. Instead use p.e. telnet
> >> or
> >> Perl-LWP's GET to request the 'raw' page directly from ISS and via
> >> Apache.
> >> Ensure the comment is there both times.
>
> >> If the comment does not pass the proxy, double check some config
> >> settings:
> >> give multiple occurrances of ProxyHTMLStripComments some special
> >> attention.
> >> (Be aware of INCLUDED config files and .htaccess)
>
> >> HansH
>
> > Solved! Replace [!-- if IE] with [! If IE] and it makes all the
> > difference.
>
> Not pleased to hear you solved the issue by twisting a bend tag....
> Do try to locate that wondering 'ProxyHTMLStripComments On'
>
> > Now just to get on with javascript errors.
>
> Are _commented_ inline scripts dropped?
> That's the same 'ProxyHTMLStripComments On' .
>
>
>
> Function alike 'window.open(...) ' might be a nasty nit to pick.
>
> Need to tweek event triggers? Check ist is listed with ProxyHTMLEvents.
>
> HansH

Hi Hans.

Thanks for the reply.

The include IE.css problem was solved by replacing the tag due to IE's
idea of uplevel and downlevel browsers. I have included both the [! if
IE] and [!-- if IE] lines so this should deal with any version of IE.
Fiddler confirms that the line is loaded when the page is requested.

The problem i am having with javascript is that i have two javascript
files is /JavaScript/ which according to Fiddler is the files are
loaded correctly. However everytime i hit the site through IE i get a
javascript runtime error "missing object on line 0". If i debug it
says it cant locate the file. Im fairly stumped now.....

Having ProxyHTMLStripComments On or Off doesnt seem to make any
difference. My conf is:

ProxyRequests off
SetOutputFilter proxy-html
LimitInternalRecursion 10

#proxyhtml setup
ProxyHTMLExtended On
ProxyHTMLMeta On
ProxyHTMLStripComments On
#ProxyBadHeader StartBody
ProxyHTMLLogVerbose On
#ProxyHTMLCharsetDefault UTF-8
#ProxyHTMLCharsetOut UTF-8
ProxyHTMLCharsetAlias ISO-8859-1 Windows-1252


ServerName domainname.co.uk
ServerAlias domainname.co.uk

#pass the proxy about
ProxyPass / http://localhost:8080/domainname/
ProxyPassReverse / http://localhost:8080/domainname/
ProxyHTMLURLMap http://localhost:8080/domainname/ /
ProxyHTMLURLMap http://localhost:8080/domainname/ http://domainname.co.uk/

#if anything asks for /domainname/ then map to proxies above
ProxyHTMLURLMap /domainname/ /
ProxyHTMLURLMap url\(http://localhost:8080/domainname/([^\)]*)\)
url(http://domainname.co.uk/$1) Rihe

#do some caching
CacheRoot "C:\\program files\\Apache Software Foundation\\Apache2.2\
\cache\\domainname.co.uk\\"
CacheEnable disk /
CacheDirLevels 5
CacheDirLength 3
CacheMaxExpire 360

RequestHeader unset Accept-Encoding


Deny from all

Re: Reverse Proxy with mod_proxy_html to IIS

am 30.11.2007 12:30:46 von HansH

"Marc" schreef in bericht
news:31434f15-b8c2-4c23-a0f7-c03ad9fecd19@d4g2000prg.googleg roups.com...
> On 29 Nov, 23:19, "HansH" wrote:
>> Function alike 'window.open(...) ' might be a nasty nit to pick.
>
> The problem i am having with javascript is that i have two javascript
> files is /JavaScript/ which according to Fiddler is the files are
> loaded correctly. However everytime i hit the site through IE i get a
> javascript runtime error "missing object on line 0". If i debug it
> says it cant locate the file. Im fairly stumped now.....
Show me the linking