regex ruby for rack-ssl-enforcer -


with regexp:

config.middleware.use rack::sslenforcer, :only => %r{^\/[a-z][a-z]+\/users/sign_in}, :strict => true  ^\/[a-z][a-z]+\/users/sign_in 

it's valid for:

/en/users/sign_in /es/users/sign_in /de/users/sign_in /fr/users/sign_in 

i add valid regexp urls like:

/en-us/users/sign_in /en/users/sign_in /en-ca/users/sign_in /zh-cn/users/sign_in . . . 

add optional non-capturing group:

^/[a-z]{2}(?:-[a-z]{2})?/users/sign_in 

note: restricts country/lang codes 2 characters. change {2,} if want "two or more".


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -