<pre name="code" class="html">redirect location <loc> [code <code>] <option> [{if | unless} <condition>]
redirect prefix <pfx> [code <code>] <option> [{if | unless} <condition>]
redirect scheme <sch> [code <code>] <option> [{if | unless} <condition>]
Return an HTTP redirection if/unless a condition is matched
May be used in sections : defaults | frontend | listen | backend
no | yes | yes | yes
If/unless the condition is matched, the HTTP request will lead to a redirect
response. If no condition is specified, the redirect applies unconditionally.
如果/除非 条件被匹配,HTTP 请求会导致重定向响应。如果没有条件被指定, 重定向无条件应用
Arguments :
<loc> With "redirect location", the exact value in <loc> is placed into
the HTTP "Location" header. When used in an "http-request" rule,
<loc> value follows the log-format rules and can include some
dynamic values (see Custom Log Format in section 8.2.4).
使用重定向位置, 准确的值在<loc> 是被放入到HTTP"Location" header.
用于"http-request" rule,
<loc> 值 遵循 log-format rules 包含一些动态值
mode http
acl being_scanned be_sess_rate gt 100
redirect location /denied.html if being_scanned
#用法三、当用户访问172.16.1.100时,重定向到http://www.afwing.com
acl dstipaddr hdr(Host) 172.16.1.100
redirect location http://www.afwing.com if dstipaddr
acl host_wx.cn hdr(Host) 120.55.118.6
redirect location http://wechatTest.winfae.com/index.html if host_wx.cn
访问 120.55.118.6 跳转到http://wechatTest.winfae.com/index.html
重定向到一个路径
<pfx> With "redirect prefix", the "Location" header is built from the
concatenation of <pfx> and the complete URI path, including the
query string, unless the "drop-query" option is specified (see
below). As a special case, if <pfx> equals exactly "/", then
nothing is inserted before the original URI. It allows one to
redirect to the same URL (for instance, to insert a cookie). When
used in an "http-request" rule, <pfx> value follows the log-format
rules and can include some dynamic values (see Custom Log Format
in section 8.2.4).
重定向前缀,the "Location" header是建立在<pfx> 相关的和完整的URI 路径,
包含查询的字符串,除非 "drop-query"选项被指定(参见下面)
作为一个特殊的例子, 如果 <pfx> 等于 /,那么什么业不会插入在原始的URI前。
它会允许重定向到相同的URL(比如,插入cookie).
当使用在 http-request 规则, <pfx> 遵循 log-format
rules
和 包含一些动态值
acl short_dom hdr(Host) -i etiantian.org
redirect prefix http://php.etiantian.org code 301 if short_dom
目的:使访问http://etiantian.org 跳转到http://php.etiantian.org
acl host_wx2.cn hdr(Host) -i wechatTest.winfae.com
redirect prefix http://wechatTest.winfae.com/index.html if host_wx2.cn
http://wechattest.winfae.com/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/
原因 wechatTest.winfae.com 匹配到这个就重定向到http://wechatTest.winfae.com/index.html ,导致写了多个Index.html
haproxy redirect location和redirect prefix
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
上一篇:k3s 初步安装
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Redirect应用
response.Redirect("http://www.baidu.com")****引号中写要跳转的页面路径
职场 应用 休闲 Redirect -
forward、redirect
forward 实际的效果是在浏览器中的地址还是原地址,存在重复提交的问题
重复提交 信息资源 请求转发