• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

web.config inheritance problems

L

LiamM

Guest
Abstract: Had quite a strange problem today on our plesk 9.3 server (windows 2008). After changing domain x from a normal vhost to a 301 redirect all websites with redirects were redirected the one I configured for domain x. This meant all our clients that had redirected websites saw their domain names forwarded to some unknown website. This seems to be a compound IIS/Plesk problem. Any help/advice from the forum at large and IgorG would be much appreciated.

Steps taken: Normal website was changed to a 301 redirect (via the 'Change hosting type' option). This didn't work out because Plesk would not accept hyphens ("-") in the URL and threw an error. Strange behavior, but easily remedied by setting this in IIS Manager (HTTP redirect option). I am pretty sure I only configured this for one website, and not for the whole server, because this error/misconfig only affected sites that had a 301 redirect configured!. I test the site, and it redirects to the expected page.

Client calls, informs us that we screwed up; domain y now redirects to the page we configured domain x to redirect to. We open domain y in Plesk; the redirect is correct. We open domain y in IIS manager; the redirect is the same as domain x!!! We edit the HTTP redir to the expected value, and restart. Now domain x redirects to same page as domain Y. Now all redirected websites redirect to one and the same URL!

Searches in the 'metabase' (applicationHost.config) show the expected redirects in the <location> nodes. We scratch our heads, and search the registry and the inetpub directory for the offending redirect URL. We find a web.config file in inetpub\vhosts\default pointing to the offending URL. After deleting this one, all is back to normal; the redirects work again, and IIS shows the right redirect for every site.

The default vhost has a binding to http:*:80 with no host name, of course. This seems to be IIS standard.

Problems here:
- Plesk wrote a web.config to the default vhost directory, and not to vhosts\domain x
- IIS apparently flubbed this, and all sites with redirects inherited this web.config!

My Theory:
- Plesk wrote the web.config to the default vhost because it could not match the website to a docroot when changing from virtual hosting to redirect hosting when it had to write the web.config
- IIS matches a request to one vhost, but gets config overrides from all matching vhosts. For example; a request for example.com matches the 'example.com' vhost AND the ':80' vhost. Apparently the last one has precedence, and redirects the user before the defaultdocument in the example.com can be executed. This doesn't make any sense, because if the web.config was really inherited this way all websites would be redirected.

Google results do not make any mention of inheritance between websites / vhosts in IIS, only in child directories or child applications / virtual dirs.

Has anyone ever encountered anything like this? Does anyone have any pointers?

edit: for clarity
 
Last edited by a moderator:
Back
Top