CNAME for CDN implementation

July 24, 2013 4k views
Hi. I want to install a CDN and I set up a CNAME for mydomain.com like: s -> mydomain.netdna-cdn.com. But, when I try to view, for example, a image from something like http://s.mydomain.com/image.jpg, It redirects me to http://s.myDEFAULT_FIRST_DIGITAL_OCEANdomain.com/image.jpg (with 404 error, obviously). Any suggestion? PS: I am using nginx.
1 comment
  • Can you post a URL of an asset where that happened? This will be easier to troubleshoot.
    I also recommend using DNS Check tools to validate your DNS setup.

4 Answers
I added the following in my nginx site config, and problem fixed! But I am not sure if it's the correct way to solve the problem.

server {
listen 8080; (NOTE: I'm using varnish)
server_name s.mydomain.com;
rewrite ^ $scheme://mydomain.netdna-cdn.com$uri;
Where are you managing your DNS? I'm not sure that any configuration needs to be made on the server, itself if you're using a third-party DNS provider, i.e. DigitalOcean's DNS Manager.
Pablo you are annoying ! If you don't know the answer than don't respond !
@daniellekwint: I don't see where Pablo's answer is incorrect? He's trying to help.
Have another answer? Share your knowledge.