• Sales: 1-800-961-2888
  • Support: 1-800-961-4454

How Do I Allow Only A Certain IP To Access My Cloud Site Using SSL?


How do I Allow only a certain IP address(es) to access my site using SSL?

On Cloud Sites, due to our unique hosting environment, we require a slight addition to the code used for the Allow only feature via SSL. Basically the issue is that the requesting IP coming into a server is the IP of our load balancing server instead of the visitor's. This means limiting access on an IP level through .htaccess becomes problematic. The answer is that we provide an environment variable called HTTP:X-Forwarded-For which has the visitor's ip.

In the .htaccess file containing your rules, place the following into your file: Allowing only a certain IP/IP Addresses:

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-For} !00\.00\.00\.000
RewriteRule .* - [F]

Replace 000\.000\.000\.000 with your IP address. This will only allow your IP address to access your site, and is a great way to develop your site without restrictions.

Important note: Implementing this code may prevent images from loading on your cloud site. To address this you can add the following code do your .htaccess file:

<FilesMatch "\.(gif|jpe?p|png)$">
order deny,allow
allow from env=allowclient
</FilesMatch>


© 2011-2013 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License


See license specifics and DISCLAIMER

2 Comments

I'd really like to lockdown FTP access for our Cloud Sites. Can you tell me how to limit access to list of allowed IP's? I'm sure this would be of interest to other clients as well.

Thanks.

Right now I don't think there is a way to apply a limit like that to FTP access. You might visit our feature request forum and ask for something like that - IP address filtering or SFTP-only, key-based access, either of those might do it. The URL for the forum is: http://feedback.rackspacecloud.com/forums/71021-product-feedback

Add new comment