主机HAPROXY的附加路径 [英] Appending Path to Host HAPROXY

查看:166
本文介绍了主机HAPROXY的附加路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是haproxy的新手(实际上通常是代理人),我不知道如何为后端添加路径.我的后端定义为:

I am new to haproxy (actually proxy'ing in general) and I can't figure out how to add a path to my backend. I have my backend defined as:

服务器server1 ns.foo.com:7170检查

server server1 ns.foo.com:7170 check

我想添加/web,以便将请求定向到 https://ns.foo. com:7170/web .

I want to add /web such that the request is directed to https://ns.foo.com:7170/web.

谢谢, 标记

推荐答案

您需要的是HTTP重写 https://www.haproxy.com/doc/aloha/7.0/haproxy/http_rewriting.html#rewriting-http-urls

What you need is HTTP rewriting https://www.haproxy.com/doc/aloha/7.0/haproxy/http_rewriting.html#rewriting-http-urls

将此添加到您的后端应该可以解决您的问题:

Adding this to your backend should solve your problem:

acl p_root path -i /
http-request set-path /web if p_root

这篇关于主机HAPROXY的附加路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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