In order to set a default-src for self it will exclude the subdomains of the origin website.
default-src 'self'
How to enable the subdomains of the self URL?
Bookmark this question. Show activity on this post. In order to set a default-src for self it will exclude the subdomains of the origin website.
You might take 'self' to mean localhost, local filesystem, or anything on the same host. It doesn't mean any of those. It means sources that have the same scheme (protocol), same host, and same port as the file the content policy is defined in.
Simple answer: No, you do not need to register a separate domain name for your subdomain. Depending on your domain name provider, there will be options to create additional subdomains.
You need to explicitly add them with fully qualified domains:
default-src 'self' sub1.example.com sub2.example.com
Or with wildcards:
default-src 'self' *.example.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With