I'm paying for a hosting service which uses cPanel, and a domain name.

Originally, my domain name pointed straight to the hosting service (as is the default).

A new layer I'm adding is a reverse proxy in between, such that my domain points to the proxy server, which then (conditionally) points back to my hosting service.

If I simply supply the IP of my hosting service to the proxy, it returns a 404. If I try to access the IP directly I also get a 404. This implies that the hosting service has restrictions on access, such that its content can only be served through my domain.

I would like to open up these restrictions to allow for my proxy server to have permission to serve it's content.

How can I open up the restrictions in cPanel to allow an external server to serve its content?

1 Answer 1


cPanel is used on shared hosting when there are many websites using the same server and shared IP address. When you just request the IP address, your host doesn't know which of the many hosted sites you want. That is the reason that your host is returning a 404 error. There are a few ways to get around this.

Use a subdomain for your origin

You can change your origin server to use a different host name. In cPanel, you can accomplish this by changing the primary domain. So your origin server used to be example.com but in the future it might be origin.example.com. You would need to add DNS records for this subdomain that point to the same server IP address. Then point the example.com and www.example.com records to your proxy server and configure your proxy server to proxy http://origin.example.com.

It would also be a good idea to put canonical tags in your pages with your preferred host name (example.com not origin.example.com) so that if search engines find the non-proxied version, they don't index it.

Configure your proxy to send a Host header

The requests that specify your origin server by IP address ( for example) just need to be upgraded with the domain name to use. The configuration for this depends on the proxy software you are using. If you are using Apache with mod_proxy, you can use the RequestHeader directive.

ProxyPass "/"  ""
ProxyPassReverse "/"  ""
RequestHeader set Host www.example.com

Use your /etc/hosts file

On your proxy server you could override DNS for example.com. You would configure your proxy server to proxy http://www.example.com and change your /etc/hosts file to have the IP address of your origin server ( for example). example.com www.example.com
  • For the last two solutions, wouldn't that just create an infinite loop where the proxy points back to origin which points to the proxy and so on?
    – Seph Reed
    Nov 6, 2019 at 22:20
  • No. The proxy would be accessible as example.com from the outside. Internally, the proxy would "think" that example.com referred to the origin. Rather than a loop, this creates a simple pipe from external, through the proxy, to the origin. Nov 6, 2019 at 22:23
  • Are the last two making the assumption that I can reference my origin server by IP then? That's what the represents?
    – Seph Reed
    Nov 6, 2019 at 22:33
  • 1
    Correct. Sorry I didn't make that clear. Nov 6, 2019 at 22:43
  • No, no, no. Thank you. This clears everything up. I don't have access to WHM, so I think my best bet will be to start hosting on my proxy server, then use a CDN to make that not so slow.
    – Seph Reed
    Nov 6, 2019 at 22:53

Your Answer

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

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