haproxy path_beg

本文介绍了如何使用不同的URL路径匹配方式来处理HTTP请求,包括前缀、目录、域名和后缀匹配等。这些方法广泛应用于缓存管理和门户站点的数据整合中。
path_beg : prefix match  前缀匹配
path_dir : subdir match
path_dom : domain match
path_end : suffix match  后缀匹配


path : string
  This extracts the request's URL path, which starts at the first slash and
  ends before the question mark (without the host part). A typical use is with
  prefetch-capable caches, and with portals which need to aggregate multiple
  information from databases and keep them in caches. Note that with outgoing
  caches, it would be wiser to use "url" instead. With ACLs, it's typically
  used to match exact file names (eg: "/login.php"), or directory parts using
  the derivative forms. See also the "url" and "base" fetch methods.
  
  提取请求的URL 的path,以第一个/开始和 在问号前结束(没有主机部分)
  
  一个典型的使用是在预取caches,
  
  和许多门户网站需要集合多个信息从数据库, 把它们放在cache里。
  
  
  path_beg 


 用于测试请求的URI是否以指定的模式开头。 第一个/开始
 
 
 http://120.55.118.6:3000/admin/api/menu
 
 http://120.55.118.6:3000/admin/api/test
  
  
  
  
  
  http://www.hyyche.com/admin/api/test
  
  
  [root@wx03 mojo]# cat test.pl 
use Mojolicious::Lite;
use JSON qw/encode_json decode_json/;  
use Encode;
no strict;
use JSON; 

# /foo?user=sri
 get '/admin/api/menu' => sub {
          my $c = shift;

          $c->render(text =>  "welcome /admin/api/menu" );
};
				   


 get '/admin/api/test' => sub {
          my $c = shift;

          $c->render(text =>  "welcome /admin/api/test" );
};


  app->start;
  
  
  
  请求带/admin开头的都转发到  相应的机器
  
  
  
  
  
  
  
  
  
  
  
  

转载于:https://www.cnblogs.com/zhaoyangjian724/p/6200063.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值