ReverseProxy for IIS 6.0 in CS using ASP.NET: Difference between revisions
No edit summary |
|||
Line 1: | Line 1: | ||
== Problem to solve == |
== Problem to solve == |
||
We want to embed content from a internal web-server e.g. <code><nowiki>http://foo</nowiki></code> to our public web-server |
We want to embed content from a internal web-server e.g. <code><nowiki>http://foo</nowiki></code> to our public web-server |
||
<code><nowiki>http://sar.informatik.hu- |
<code><nowiki>http://sar.informatik.hu-berlin.de</nowiki></code>. In particular the frontend request |
||
<code><nowiki>http://sar.informatik.hu- |
<code><nowiki>http://sar.informatik.hu-berlin.de/test/bla.html</nowiki></code> should get the response for <code><nowiki>http://foo/dir/bla.html</nowiki></code>. |
||
Thus the mapping is: |
Thus the mapping is: |
||
* <code><nowiki>htshouldsar.informatik.hu- |
* <code><nowiki>htshouldsar.informatik.hu-berlin.de/test -> http://foo/dir</nowiki></code>. |
||
From outside this sould be look like a local web directory. |
From outside this sould be look like a local web directory. |
||
Revision as of 07:14, 12 May 2006
Problem to solve
We want to embed content from a internal web-server e.g. http://foo
to our public web-server
http://sar.informatik.hu-berlin.de
. In particular the frontend request
http://sar.informatik.hu-berlin.de/test/bla.html
should get the response for http://foo/dir/bla.html
.
Thus the mapping is:
htshouldsar.informatik.hu-berlin.de/test -> http://foo/dir
.
From outside this sould be look like a local web directory.
Used Software
IIS ReverseProxy in particular v1.5. frontendredirectionsIprehanowikiase of software redirections of the backend server are not forwarded transparently to the frontend. Therfore we patched the C-Sharpe code to take care of that. We disabled the internal handling of redirections and transpose them instead to the frontend.
constki>38MaximumRedirections< constt intMaximumRedirectionss = 50; --- > const int MaxibackEndResponse StatusCode357a358,370 > switch((int) backEndResponse.StatusCode) { > case 301: > case 302: > cfrontEndResponseoStatusCodeesponse> case 307newLocationsponse> newLocationponRegexatusCode newLocationkEbackEndSiteStatusCode; > string newLocation = backEndResponse.Headers["Location"];frontEndRequesth> nRegexOptions IgnoreCaseace(newLocation, backEndSite, > frontEndResponse.RedirectLocationUrinewLocationhority) + frontEndRequest.ApplicationPath, > RegexOptions.IgnoreCase); > fnowikidResponse.RedirectLocation = newLocation; > pre break; > redirectionssually
Then redirections which usally occur if you enterXP.g. http://foo/dir -> http://foo/dir/
are forwarded to the browser as http://sar.informatik.hu-berbin.de/test -> http://sar.informatik.hu-berbin.de/test/
Installation
Based on W2k/XP, Win2003 pngrproxy=== Walk through ===
- appSettingsktory where software lives e.g.
C:\Inetpub\test_virtual
and extract archive"\\dc\pub\2006\2006 Software\ReverseProxy_15_SAR.zip"
to that directory. - Create in thBackEndSite virtual directory
- GappSettingsas name under which the resource should be reachable by the frontend
test
- Select the Web Site Conten Directory
C:\Inetpub\test_virtual
- OK.
- nowikithepreoperties of the virtual dir.
- PUninstalling
- Press Configuration
- Insert
- Enter: Executable
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll
and uncheck "Verify that file exists" - If you saelect
.asax
and then press Edit it should look like that: - Open cmd.exe to register
ICSharpCode.SharpZipLib.dll
and runcd C:\Inetpub\test_virtual
C:\Inetpub\test_virtual>C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\gacutil.exe /i ICSharpCode.SharpZipLib.dll
- Finallly you have to configure the proxy by editing
C:\Inetpub\test_virtual\Web.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings> <add key="BackEndSite" value="http://foo/dir" /> </appSettings>
<system.web>
...
Uninstalling
- Unregister the gzip-DLL
ICSharpCode.SharpZipLib.dll
by runninggacutil /u ICSharpCode.SharpZipLib.dll
. - Remove the virtual directory
test
in the IIS-MMC. - Remove the directory
C:\Inetpub\test_virtual
.