使用path_reg匹配haproxy路径 [英] Match haproxy path using path_reg

查看:473
本文介绍了使用path_reg匹配haproxy路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将以下网址匹配:/rivers/1,/rivers/2adsfs,/rivers/sdfd2d与

I'm trying to match urls like: /rivers/1, /rivers/2adsfs, /rivers/sdfd2d with:

  acl rivers_show   path_reg ^/rivers/\w+/?

但这似乎确实有效.有人知道为什么吗?

But that does seem to work. Anyone know why?

推荐答案

HAproxy的正则表达式不包含\ w作为字符类.请记住,正则表达式是性能最差的ACL匹配之一.您可能想研究使用类似这样的东西,尽管它并不完全相同.

HAproxy's regex does not include \w as a character class. Keep in mind regex is one of the worst performing ACL matches. You may want to look into use something like this instead, although its its not exactly the same.

acl path_beg/rivers/

acl path_beg /rivers/

这篇关于使用path_reg匹配haproxy路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆