大网数据广告活动
服务器运维问答

difference between url_beg and path_beg in haproxy

· 52CE 我爱测

Haproxy doc prefers using path_beg over url_beg to match path in urls. As per https://cbonte.github.io/haproxy-dconv/configuration-1.5.html#url : With ACLs, using "path" is preferred over using "url", because clients may send a f…

问题原文

原帖链接 · Deepak Deore · CC BY-SA 3.0

Haproxy doc prefers using path_beg over url_beg to match path in urls.

As per https://cbonte.github.io/haproxy-dconv/configuration-1.5.html#url:

With ACLs, using "path" is preferred over using "url", because clients may send a full URL as is normally done with proxies.

Seems that in above case url_beg wont work, I didn't understand what does it mean. Can I have curl send full url as is which will not be matched by url_beg but path_beg will match it?

已采纳解答

原帖链接 · kubanczyk · CC BY-SA 4.0

You need to prepare haproxy for some non-standard requests too. Take a look at this weird GET:

$ echo -ne "GET http://google.com/books/ HTTP/1.1\r\nHost: google.com\r\n\r\n" | nc -v google.com 80
Connection to google.com 80 port [tcp/http] succeeded!
HTTP/1.1 301 Moved Permanently
Location: http://books.google.com/books/
...

For comparison, the standard way:

$ echo -ne "GET /books/ HTTP/1.1\r\nHost: google.com\r\n\r\n" | nc -v google.com 80
Connection to google.com 80 port [tcp/http] succeeded!
HTTP/1.1 301 Moved Permanently
Location: http://books.google.com/books/
...

And how to produce the same weird GET with curl:

$ curl -v --request-target http://google.com/books/ http://google.com/books/
*   Trying 172.217.16.14...
* TCP_NODELAY set
* Connected to google.com (172.217.16.14) port 80 (#0)
> GET http://google.com/books/ HTTP/1.1
> Host: google.com
> User-Agent: curl/7.55.1
> Accept: */*
> 
< HTTP/1.1 301 Moved Permanently
< Location: http://books.google.com/books/

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-04-27)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。