Enable access only to certain ip addresses
9 posts
• Page 1 of 1
Enable access only to certain ip addresses
Hi
I have a rule like this:
RewriteEngine on
RewriteBase /
RewriteRule ^backend/(.*)$ http://ipaddress:8088/backend/$1 [NC,P]
It works.
Now I want to disable access to "backend" app to all remote address except the internal ones.
Which is the right directive to use?
thanks
I have a rule like this:
RewriteEngine on
RewriteBase /
RewriteRule ^backend/(.*)$ http://ipaddress:8088/backend/$1 [NC,P]
It works.
Now I want to disable access to "backend" app to all remote address except the internal ones.
Which is the right directive to use?
thanks
Re: Enable access only to certain ip addresses
Hello,
Please try to use the following syntax:
RewriteEngine on
RewriteBase /
RewriteCond %{REMOTE_ADDR} (?:list|allowed|ip|addresses|here)
RewriteRule ^backend/(.*)$ http://ipaddress:8088/backend/$1 [NC,P]
Please try to use the following syntax:
RewriteEngine on
RewriteBase /
RewriteCond %{REMOTE_ADDR} (?:list|allowed|ip|addresses|here)
RewriteRule ^backend/(.*)$ http://ipaddress:8088/backend/$1 [NC,P]
Re: Enable access only to certain ip addresses
Which is the right syntax to separate ip addresses?
Thanks
Thanks
Re: Enable access only to certain ip addresses
and also:
if i have more webapplication that can be accessed by those ip addresses, it is possible to define the rule one?
for example:
RewriteCond %{REMOTE_ADDR} (?:IP)
RewriteRule ^admin/(.*)$ http://InternalIP:8080/admin/$1 [NC,P]
RewriteRule ^backend/(.*)$ http://InternalIP:8080/backend/$1 [NC,P]
If I write this way, the second rewriterule doesn't consider the ip filter.
Thanks
if i have more webapplication that can be accessed by those ip addresses, it is possible to define the rule one?
for example:
RewriteCond %{REMOTE_ADDR} (?:IP)
RewriteRule ^admin/(.*)$ http://InternalIP:8080/admin/$1 [NC,P]
RewriteRule ^backend/(.*)$ http://InternalIP:8080/backend/$1 [NC,P]
If I write this way, the second rewriterule doesn't consider the ip filter.
Thanks
Re: Enable access only to certain ip addresses
I think you'd need to repeat the rewritecond before the second rule.
I wonder whether, if this gets unwieldy, it would be better to use a rewritemap for the IP addresses instead of a list?
I wonder whether, if this gets unwieldy, it would be better to use a rewritemap for the IP addresses instead of a list?
Re: Enable access only to certain ip addresses
I doon't know if i'm right, but i think there are some directive (like NC and P) that can be used to decide which is the last rule that should be considered for that rewrite condition.
Example:
RewriteCond %{REMOTE_ADDR} (?:IP)
RewriteRule ^admin/(.*)$ http://InternalIP:8080/admin/$1 [something here to tell that above condition shoul be used also for the following rules]
RewriteRule ^backend/(.*)$ http://InternalIP:8080/backend/$1 [something here to tell that above condition shoul not be used anymore for the following rules]
Example:
RewriteCond %{REMOTE_ADDR} (?:IP)
RewriteRule ^admin/(.*)$ http://InternalIP:8080/admin/$1 [something here to tell that above condition shoul be used also for the following rules]
RewriteRule ^backend/(.*)$ http://InternalIP:8080/backend/$1 [something here to tell that above condition shoul not be used anymore for the following rules]
Re: Enable access only to certain ip addresses
Using multiple lines like this:
RewriteCond %{REMOTE_ADDR} (?:first_ip)
RewriteCond %{REMOTE_ADDR} (?:second_ip)
RewriteCond %{REMOTE_ADDR} (?:third_ip)
will allow access only to 3rd ip
I'm looking for a single line with multiple ip
Thanks
RewriteCond %{REMOTE_ADDR} (?:first_ip)
RewriteCond %{REMOTE_ADDR} (?:second_ip)
RewriteCond %{REMOTE_ADDR} (?:third_ip)
will allow access only to 3rd ip
I'm looking for a single line with multiple ip
Thanks
9 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 23 guests