« Previous Next »

Thread: Help - Internal vs External - Publish One Site in Two Places?

Last post 07-07-2008 6:48 PM by kiwi_dude. 2 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (3 items)

Sort Posts:

  • 07-07-2008, 5:33 PM

    Help - Internal vs External - Publish One Site in Two Places?

     Hi All,

    We have two websites that are PHP based. Both have LDAP/SSO integrated. Essentially, if the user is logged in internally (within the network) the application recognizes the logged in user server variable is available and does SSO, if the user reaches the wesbite externally, the logged in user server variable is not available and a login form is presented by the PHP script and the user is logged in against the LDAP server this way.

     The easy way to accomplish this would be to enable both Anonymous and Windows Authentication, if the logged in server variable AUTH_USER is available then Windows Authentication is used, if not Anonymous Authentication would used ie  Integrated Authentication and fall back to Anonymous. Doing this would allow the script to handle authentication and publish public content.

     Unfortunately, IIS does allow this. if Anonymous Authentication is enabled the AUTH_USER variable is not set, even if the user is logged in the network. (Is this a bug or a feature??)

    The only way we have found to use both anonymous and windows authentication on the same site, is to publish the same site (same root folder/duplicated virtual folders etc) twice. One that is used internally with windows authentication enabled and one externally with anonymous authentication enabled.

    Each site is bound to different IP, with the internal site using the internal DNS setting to direct all internal requests for our domain name to ip1 and all external requests for our domain name handled by ISA and forwarded to ip2

    This setup worked well for us in IIS6, but in IIS7 we have run into a few issues.

    1. Because the sites are sharing the same web root, the web.config that is created is used by both (ie only one is created even though their are two site names).

    Is there a way to enable two sites with the same web root to have different web.config settings/files?

    2. Because the external site is forwarded through our ISA proxy, the REMOTE_HOST & SERVER_NAME variables are set to an IP address not the host name. This causes the external site to use the internal ip sometimes which does not work externally and all our statistics are now reporting that the web address is http://192.168.x.xx/index.php instead of http://www.domainname.com/index.php etc

    The fact that that the REMOTE_HOST and SERVER_NAME variables are giving a IP address instead of a HostName iis puzzling because this works fine on IIS6 with the same ISA forwarding (with pass though of host headers).

    How can I ensure that a specific site has the REMOTE_HOST and SERVER_NAME variable set?

    Why would IIS7 handle this differently than IIS6 (I have verified all this with PHPinfo() and have some screenshots to assist if needed)

    We are trying migrate our sites across and this is urgent for us.

     Any assistance would be greatly appreciated.

     Cheers

    Dean
     

  • 07-07-2008, 5:54 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: Help - Internal vs External - Publish One Site in Two Places?

    1. Do not use web.config for the settings if you want to have sites with a common root but different settings - but instead commit the settings to applicationhost.config with the appropriate location tag - if using appcmd, add -commitpath:apphost to the command - or if using UI, either lock the section, or use the "Configuration Editor" in the admin-pack and choose the commit path to make the setting be written to applicationhost.config.

    2. For REMOTE_HOST, you can turn on reverse-dns-lookup using system.webServer/security/ipSecurity/enableReverseDns setting.  For SERVER_NAME, this value comes from the request Host header, if no host header is present then ip-address of the server is used unless overridden using system.webServer/serverRuntime/alternateHostName setting (SetHostName setting in IIS6).

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 07-07-2008, 6:48 PM In reply to

    Re: Help - Internal vs External - Publish One Site in Two Places?

     Hi Anilr,

     Thank you for your response. I will try these as suggested

     Thanks

     Dean

Page 1 of 1 (3 items)
Microsoft Communities