Cloudflare force second level domain to first level

#1

Hi. I binded my server ip with first level domain and configure my nginx with this domain for example domain.name - 88.88.88.88 , after that i created second level domain second.domain.name and binded to the same IP 88.88.88.88. But on the nginx config i do nothing and also didn’t reload nginx. Thats interesting when i pass https://second.domain.name to chrome command line i see my site which located at https://domain.name. How come? i configured just domain.name but not second.domain.name.

domain.name and 88.88.88.88 - Just for Example.

#2

Didn’t really the issue and can’t test anything without having the domain.

1 Like
#3

Sounds like your default virtual server config is likely set to answer for domain.name and *.domain.name.

#4

Nginx configuration, there is just one first level domain and thats it.
But if i add to cloudflare test.domain.org, it is opens but i can see site from domain.org.
But if i configure my nginx with test.domain.org, create config and etc it works fine.

 server {
    	listen 80;

    	set_real_ip_from 0.0.0.0/0;
    	real_ip_header X-Forwarded-For;

    	root /var/www/vhosts/domain.org/;

    	server_name domain.org;

    	location = / {
    		proxy_set_header Host $host;
    		proxy_set_header X-Real-IP $remote_addr;
    		proxy_pass http://ip:8880;
    	}

    	location ~ / {
    		proxy_set_header Host $host;
    		proxy_set_header X-Real-IP $remote_addr;
    		proxy_pass http://ip:8880;
    	}

    	location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|pdf|ppt|txt|bmp|rtf)$ {
    		expires max;
    		add_header Cache-Control public;
    	}
    }
closed #5

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.