
Reverse Proxy with mod_proxy_html to IIS
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:
<!--[if IE]><link rel="stylesheet" type="text/css" href="css/ie.css" /
><![endif]-->
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
<VirtualHost *:80>
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
<LocationMatch "^[^/]">
Deny from all
</LocationMatch>
</VirtualHost>
Re: Reverse Proxy with mod_proxy_html to IIS
"Marc" <marc.birkett [at] gmail.com> schreef in bericht
news:c7dcb157-3bab-4ed4-bd64-3449e2b0d159 [at] 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:
>
> <!--[if IE]><link rel="stylesheet" type="text/css" href="css/ie.css" /
>><![endif]-->
>
>
> 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 <link ...>.
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]><link" href
Just 2 ct
HansH
Re: Reverse Proxy with mod_proxy_html to IIS
On 28 Nov, 17:42, "HansH" <ha... [at] invalid.invalid> wrote:
> "Marc" <marc.birk... [at] gmail.com> schreef in berichtnews:c7dcb157-3bab-4ed4-bd64-3449e2b0d159 [at] 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:
>
> > <!--[if IE]><link rel="stylesheet" type="text/css" href="css/ie.css" /
> >><![endif]-->
>
> > 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 <link ...>.
> 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]><link" href
>
> 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
<link rel="stylesheet" type="text/css" href="css/ie.css" />
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
On 28 Nov, 17:42, "HansH" <ha... [at] invalid.invalid> wrote:
> "Marc" <marc.birk... [at] gmail.com> schreef in berichtnews:c7dcb157-3bab-4ed4-bd64-3449e2b0d159 [at] 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:
>
> > <!--[if IE]><link rel="stylesheet" type="text/css" href="css/ie.css" /
> >><![endif]-->
>
> > 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 <link ...>.
> 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]><link" href
>
> 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
"Marc" <marc.birkett [at] gmail.com> schreef in bericht
news:8975eac8-8fc2-4be6-a2b8-107a5375446d [at] e23g2000prf.google groups.com...
>> > <!--[if IE]><link rel="stylesheet" type="text/css" href="css/ie.css" /
>> >><![endif]-->
>>
>> > 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
>
> <link rel="stylesheet" type="text/css" href="css/ie.css" />
>
> 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
On 29 Nov, 10:45, "HansH" <ha... [at] invalid.invalid> wrote:
> "Marc" <marc.birk... [at] gmail.com> schreef in berichtnews:8975eac8-8fc2-4be6-a2b8-107a5375446d [at] e23g2000prf .googlegroups.com...>> > <!--[if IE]><link rel="stylesheet" type="text/css" href="css/ie.css" /
> >> >><![endif]-->
>
> >> > 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
>
> > <link rel="stylesheet" type="text/css" href="css/ie.css" />
>
> > 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
"Marc" <marc.birkett [at] gmail.com> schreef in bericht
news:ed71d8d5-a0cf-4ed8-a299-81e0f0e4685d [at] v4g2000hsf.googleg roups.com...
> On 29 Nov, 10:45, "HansH" <ha... [at] invalid.invalid> wrote:
>> "Marc" <marc.birk... [at] gmail.com> schreef in
>> berichtnews:8975eac8-8fc2-4be6-a2b8-107a5375446d [at] 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' .
<!--
<script javascript>
function HoeZoeken(){
window.open ("/info/hoezoeken.html","HoeZoeken)
}
</script>-->
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
On 29 Nov, 23:19, "HansH" <ha... [at] invalid.invalid> wrote:
> "Marc" <marc.birk... [at] gmail.com> schreef in berichtnews:ed71d8d5-a0cf-4ed8-a299-81e0f0e4685d [at] v4g2000hsf. googlegroups.com...
>
> > On 29 Nov, 10:45, "HansH" <ha... [at] invalid.invalid> wrote:
> >> "Marc" <marc.birk... [at] gmail.com> schreef in
> >> berichtnews:8975eac8-8fc2-4be6-a2b8-107a5375446d [at] 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' .
>
> <!--
> <script javascript>
> function HoeZoeken(){
> window.open ("/info/hoezoeken.html","HoeZoeken)}
>
> </script>-->
>
> 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
<VirtualHost *:80>
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
<LocationMatch "^[^/]">
Deny from all
</LocationMatch>
</VirtualHost>
Re: Reverse Proxy with mod_proxy_html to IIS
"Marc" <marc.birkett [at] gmail.com> schreef in bericht
news:31434f15-b8c2-4c23-a0f7-c03ad9fecd19 [at] d4g2000prg.googleg roups.com...
> On 29 Nov, 23:19, "HansH" <ha... [at] invalid.invalid> 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 <script .... > line with and without proxy.
> 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
Just in case inheritence from server to vhost is failing (seen before on
other mods):
Move these ProxyHTML* directives out to a seperate file ProxyHTML.conf, then
adding per vhost
<include ProxyHTML.conf>
> <VirtualHost *:80>
> ServerName domainname.co.uk
> ServerAlias domainname.co.uk
Check 'ProxyHTMLStripComments (on|off) again ...
Hans
Re: Reverse Proxy with mod_proxy_html to IIS
On 30 Nov, 11:30, "HansH" <ha... [at] invalid.invalid> wrote:
> "Marc" <marc.birk... [at] gmail.com> schreef in berichtnews:31434f15-b8c2-4c23-a0f7-c03ad9fecd19 [at] d4g2000prg. googlegroups.com...> On 29 Nov, 23:19, "HansH" <ha... [at] invalid.invalid> 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 <script .... > line with and without proxy.
>
>
>
> > 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
>
> Just in case inheritence from server to vhost is failing (seen before on
> other mods):
> Move these ProxyHTML* directives out to a seperate file ProxyHTML.conf, then
> adding per vhost
> <include ProxyHTML.conf>
>
> > <VirtualHost *:80>
> > ServerName domainname.co.uk
> > ServerAlias domainname.co.uk
>
> Check 'ProxyHTMLStripComments (on|off) again ...
>
> Hans
Hi Hans.
Thanks for the quick response. (Maybe i should have done this first) I
spoke to the developer of the website today and it appears that the
javascript error is a known issue on IIS which he is in the process of
sorting.
Im calling this sorted at the moment as the sites when reverse proxied
through Apache show the same behavior as IIS.
Hes getting on to sort his dodgy js.....
Thanks for your help!
Marc