tomcat7 - Block all other url's in HAPROXY -
i have couple of rules defined in haproxy
acl want_server_oa path_dir serveroa acl serveroa_avail nbsrv(serveroa) ge 1 use_backend serveroa if want_server_oa serveroa_avail acl is_root hdr_dom(host) -i mydomain.com use_backend domainroot if is_root
the first 3 rules setup route traffic subdomain
mydomain.com/serveroa/
and next 2 rules route traffic
mydomain.com/
this works expected. however, if type in
mydomain.com/anypath/
it gives me tomcat 404. suspect second set of rules match , forward traffic tomcat returns 404.
based on documentation, did try defining acls blocking other paths didn't quite work (configuration wasn't accepted when starting haproxy).
block unless meth_get or meth_post want_server_oa block unless meth_get or meth_post is_root
any appreciated.
you must explicitly define items allow accessible under root "mydomain.com/" , subfolders block
others. (shouldn't lot, right?)
acl want_server_oa path_beg /serveroa acl allow_html path_reg -i /.*\.html acl allow_styles path_reg -i /css/.*\.css block unless meth_get want_server_oa or meth_post want_server_oa or meth_get allow_html or meth_post allow_html or meth_get allow_styles or meth_post allow_styles
additional note: can check if configuration have errors using haproxy -c
command. so:
haproxy -f /etc/haproxy/haproxy.cfg -c
Comments
Post a Comment