ssl - Redirecting wildcard subdomains to a different top-level domain with nginx -


we have bunch of wildcard subdomains (_foo.example.com, bar.example.com, etc) that, when accessed via https should redirect equivalent subdomain on our secure domain.

some examples:

i think can accomplished nginx rewrites i'm not sure syntax. here's i'm attempting:

server {     listen        443;     server_name   *.example.com;      rewrite       ^(.*)   https://*.secure.com$1 permanent; } 

this won't work because i'm not capturing incoming subdomain , using in rewrite.

try (untested):

server {     listen 80;     listen 443 default ssl;      server_name "~^(?<name>\w\d+)\.example\.com$";      rewrite ^(.*) https://$name.secure.com$1 permanent; } 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -