Objective
Once you have purchased yourself a domain (e.g. domain.com) or multiple domain (e.g. domain1.com, domain2.com), you may be required to expose web services to the internet.
Instead of using ports (e.g. domain1.com:10023, domain1.com:10024, domain2.com:20023, domain2.com:20024) and doing port forwarding for every single services you may host, it will be more elegant to use subdomain to segregate (e.g. www.domain1.com, git.domain1.com, www.domain2.com, cpanel.domain2.com)
Sometimes you just want to point every single subdomain to a server to do the same thing. That’s where wildcard is needed to do reverse proxy.
DSM7
No workaround yet to be found for DSM version ≥7.0
DSM6
SSH into your Synology box
ssh [email protected]
Edit nginx-conf-generator.sh file
vi /usr/syno/etc/rc.sysv/nginx-conf-generator.sh
Edit the following line
#find the following line around line 29
GenerateConf "$SZF_NGINX_MUSTACHE" "$tmp" "$SZF_TMP_NGINX_CONF" || true
if [ -s "$SZF_RP_DATASTORE" ]; then
#add the following block
sed -i 's/\("fqdn" \+: \+\)"wildcard\.\([^"]*\)"/\1"*.\2"/g' "$SZF_RP_DATASTORE"
#end of the appended block
GenerateConf "$SZD_MUSTACHE/Portal.mustache" "$SZF_RP_DATASTORE" "$SZD_TMP_APP_D/server.ReverseProxy.conf" || true
fi
All the domains of the form wildcard.<domain> will be internally treated as *.<domain>. However, it will still appear as wildcard.<domain> in the web interface
Source: Add support for wildcard domains in ReverseProxy : synology (reddit.com)