Reputation: 1
Ruby code:
halt 403 unless url.host == 'xyz.webserver.com'
there are many sub domains like xyz. What is the solution if I would like to allow all the sub domains.
Any help would be appreciated.
halt 403 unless url.host == 'xyz.webserver.com'
Upvotes: 0
Views: 35
Reputation: 211690
Another approach is to use case
:
case url.host
when /\.webserver\.com\z/i
halt 403
end
Where that's case-insensitive (/i
) and allows you to add other rules as necessary.
Upvotes: 0
Reputation: 24337
One way to do this would be to use String#end_with?
halt 403 unless url.host.end_with?('.webserver.com')
Upvotes: 2