Mosso Cloud and .htaccess issues

Mosso Cloud and .htaccess issues

I have to deal with all kinds of issues at work and today I learned about how Mosso (a cloud hosting company) doesn't play nice with request ip addresses. Basically the issue is that the requesting ip coming into a server is the ip of their load balancing server instead of the visitor's. This means limiting access on an ip level through .htaccess becomes problematic. The answer is that they provide an environment variable called X-Cluster-Client-Ip which has the visitor's ip. Now this can be checked and access can be restricted using this. I have included an example .htaccess script below.

SetEnvIf X-Cluster-Client-Ip 255.15.255.300 allowclient
order deny,allow
deny from all
allow from env=allowclient

Now, i would assume other cloud hosting companies would have something similar. Anyway just caused a few hours of head ache, especially when the owner calls you and says fix it.

Richard
04/29/2009 - 07:57

I'm having to do the same thing, did you have any problem with the display of images?

I'm wondering if their media accelerator servers use a different variable as I have used both the classic "deny from " as well as the method you mention above, and text content works, but all images give me a 403.

Not really sure how to progess!

reply

The Fattest
04/29/2009 - 09:07

Yeah I had the same issue. I had to add the following to the end of my .htaccess file.

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

The main thing is here is to make sure that the FilesMatch regular expression has all the correct file extensions.

reply

Richard
04/29/2009 - 09:42

Works perfect (except it should be "jpe?g")!

I will point the engineers at this link, thanks.

reply

dralezero
12/15/2009 - 16:02

Thanks! This fixes the images issue!

reply

mark
09/01/2010 - 12:39

thank you for sharing, this saved my some headache!

reply

Anonymous
07/19/2011 - 16:17

Hi,
This is good information - I'm curious if you know how do do a block of an IP range. e.g. block a class C or B.

I tried similar syntax to what you had, but without success:

SetEnvIf X-Cluster-Client-Ip 182.236. blockclient
Order Allow,Deny
Deny from env=blockclient
Allow from all

reply

Add Comment

Put code snippets inside language tags:
[language] [/language]

Examples:
[javascript] [/javascript]
[actionscript] [/actionscript]
[csharp] [/csharp]

See here for supported languages.

Javascript must be enabled to submit anonymous comments - or you can login.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.