开发者

How do I deny access to a specific URL in my rails app?

开发者 https://www.devze.com 2022-12-26 12:39 出处:网络
I have a rails app that has a private component and a public component. www.hostname.com/ is private and should only be accessed from inside our firewall, but i want to allow access to www.hostname.c

I have a rails app that has a private component and a public component.

www.hostname.com/ is private and should only be accessed from inside our firewall, but i want to allow access to www.hostname.com/public to internet users. I played around with the apache vhost config but it seems when I allow access to www.hostname.com it allows all the paths 开发者_如何学Gobelow it as well. Any help would be very appreciated.


in your web root (/var/www) create this .htaccess file:

Order deny,allow
Deny from all
allow from 192.168.0.0/24

In your public folder (/var/www/public) create a new .htaccess folder that contains this line:

allow from all

Make sure .htaccess overrides is enabled in your apache/vhost configs, this should be enabled by default.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号