NGINX + 301 Return for my CDN

281 views Asked by At

I have a redirect on my server running so that all my traffic redirects to https shown here:

    server {
       listen         80;
       server_name    example.com  www.example.com;
       return         301 https://$server_name$request_uri;
}

That works great, however now I am using a CDN and my CDN defaults to HTTPS, I want my cdn.example.com to force http and not https, is this possible? When it forces https, since i dont have a valid ssl certificate for it, it wont load on most browsers.

My dns is:

example.com A 192.168.1.1
www.example.com CNAME example.com
cdn.example.com CNAME example.cdnexample.com (external host, amazonwebservices)
0

There are 0 answers