castris
Verified User
Hi,
After updating to 1.710/1.711 and the subsequent config rewrite, every subdomain of some domains started serving the parent domain's application. Nothing was edited by hand; it took us a while to find the cause, so I'm sharing it here and asking for a safeguard.
Setup (all native DirectAdmin mechanisms):
Before 1.710: each subdomain's Apache VirtualHost used its own document root from the panel setting. This had worked for over a year.
After 1.710: the 1.710 changelog says:
The stock virtual_host2_sub.conf / virtual_host2_secure_sub.conf now have DocumentRoot "|DOCROOT|" after |CUSTOM|, so the domain-level |?DOCROOT=| overrides the panel's per-subdomain document root. Result for every subdomain:
nginx still had the correct per-subdomain root, so static files looked fine while PHP (proxied to Apache) ran the parent's app. Nothing logged an error, and the panel still shows the correct document root for each subdomain.
Scale: a sweep across our fleet found 10 affected domains (21 subdomains) on 2 servers, plus around 50 domains carrying the same unconditional |?DOCROOT=| that will break as soon as someone adds a subdomain to them.
Fix we applied (from your own docs, https://docs.directadmin.com/webservices/apache/customizing.html):
What I'd like to ask:
Thanks.
After updating to 1.710/1.711 and the subsequent config rewrite, every subdomain of some domains started serving the parent domain's application. Nothing was edited by hand; it took us a while to find the cause, so I'm sharing it here and asking for a safeguard.
Setup (all native DirectAdmin mechanisms):
- nginx + Apache reverse proxy (nginx_apache).
- Domain example.com has a Custom HTTPD Configuration (Apache) with a single line, the usual Laravel /public pattern:
Code:|?DOCROOT=`HOME`/domains/example.com/public_html/public| - Its subdomains have their own document root set from the panel (the per-subdomain document root override, stored in example.com.subdomains.docroot.override), e.g. sub.example.com -> /domains/sub.example.com/public_html/public.
Before 1.710: each subdomain's Apache VirtualHost used its own document root from the panel setting. This had worked for over a year.
After 1.710: the 1.710 changelog says:
The DOCROOT token will be used for both domains and subdomains. Previous releases used the SDOCROOT token for subdomain document root.
The stock virtual_host2_sub.conf / virtual_host2_secure_sub.conf now have DocumentRoot "|DOCROOT|" after |CUSTOM|, so the domain-level |?DOCROOT=| overrides the panel's per-subdomain document root. Result for every subdomain:
Code:
<VirtualHost x.x.x.x:8081 127.0.0.1:8081 >
ServerName sub.example.com
DocumentRoot "/home/user/domains/example.com/public_html/public" <- parent's docroot
nginx still had the correct per-subdomain root, so static files looked fine while PHP (proxied to Apache) ran the parent's app. Nothing logged an error, and the panel still shows the correct document root for each subdomain.
Scale: a sweep across our fleet found 10 affected domains (21 subdomains) on 2 servers, plus around 50 domains carrying the same unconditional |?DOCROOT=| that will break as soon as someone adds a subdomain to them.
Fix we applied (from your own docs, https://docs.directadmin.com/webservices/apache/customizing.html):
Code:
|*if !SUB|
|?DOCROOT=`HOME`/domains/example.com/public_html/public|
|*endif|
What I'd like to ask:
- I know the docs already said a domain-level |?DOCROOT=| applies to subdomains too. In practice, though, a panel-native per-subdomain document root used to win, and now it silently loses. A setting the user made in the panel UI being overridden without any warning is what hurts here.
- For the www. subdomain alias change in the same release you shipped create-subdomain-www-aliases (check + fix). Could you add the same kind of maintenance check for this one? It would list domains whose custom httpd/nginx config sets DOCROOT without |*if !SUB| while they have subdomains, or have subdomains with a document root override, and optionally wrap the line automatically.
- Even a warning in the "Custom HTTPD Configurations" page when |?DOCROOT=| is used without !SUB on a domain with subdomains would prevent this.
Thanks.