I am trying to block URL’s that does not contain a word “Developer” in the URL’s query string urls.primaryName
’s value.
URL’s to block:
- /swaggerui/PetStore/index.html?urls.primaryName=V1-Private
- /swaggerui/PetStore/index.html?urls.primaryName=V1-Internal
URL’s to allow:
- /swaggerui/PetStore/index.html?urls.primaryName=V1-Developer
Below is the configuration I have tried.
frontend http-in
acl url_petstore_v2 path_beg -i /swaggerui/PetStore/
use_backend petstore_v2 if url_petstore_v2
backend petstore_v2
http-request deny if { path_reg /swaggerui/PetStore/index\.html\?urls\.primaryName=(?i)(?!.*Developer).* }
server petstore1 $PS_HOST$SERVER_ADDRESS_TAIL:$PS_PORT check $TLS_APPEND $HAPROXY_RESOLVER_EXPR
Regex expression I have used does match the URL’s as you can see in this online regex test tool.
But this configuration is not blocking the URLs and allowing all the URLs.