I am setting up a Cloudfront Distribution.

In this article https://aws.amazon.com/blogs/startups/how-to-accelerate-your-wordpress-site-with-amazon-cloudfront/, it said "you can simply type the DNS name or IP address if it not listed." as the origin. However, when I input an IP address as the origin, I get an error indicating "IP cannot be used as the origin name". Why?


1 Answer 1


There are two reasons that I wouldn't expect a CDN to allow you to specify the origin server by IP address:

  • Most websites are not accessible via IP address. Most hosting is on shared hosting where every IP address has many websites. Even if you have dedicated hosting with your own IP address, you would usually want to be able to serve several of your own domain names from your servers.
  • Security certificates for IP addresses are are uncommon and expensive. (Free LetsEncrypt certificates are not available for IP addresses, for example.) Most users aren't going to be able to enable HTTPS to the origin server by IP address.

Because there are few users that would have a dedicated IP address just for one domain and be willing to pay for the the certificate for it, it would make sense to simplify and only allow host names and not IP address. It would be less headache for them not to have to support IP addresses and prevent problems of users trying to use an IP address that isn't likely to work.

If you do have an IP address just for your site, the workaround is to create a host name for it. For example you could create the subdomain origin.example.com on your domain example.com. The origin subdomain would point to the IP address of your server.

  • Thank you. But using subdomain origin.example.com will cause problems in WordPress. If using origin.example.com, what should be set for WordPress SiteURL and HomeURL? If setting to origin.example.com, then WordPress will take origin.example.com as the canonical URL, which is obviously undesired. However, if set to www.example.com, then the site will not be loaded properly.
    – alancc
    Oct 3, 2021 at 20:55
  • @alancc Leave your WordPress site alone. It would still respond to requests for example.com but whitelist the Host header in cloudfront so that www.example.com gets passed to wordpress. See on StackOverflow: Any way to set up AWS Cloudfront to point to static IP address (WP hosted on GoDaddy)? Oct 4, 2021 at 12:56
  • Sorry but I can still not understand as how to setup my WordPress on the origin. Which SiteURL and HomeURL should I use? I cannot leave it alone as it is the CMS on the origin. Thank you.
    – alancc
    Oct 4, 2021 at 21:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.