您的位置:首页 > 其它

service mesh的linkerd的postman测试问题

2018-02-26 11:11 381 查看
测试linkerd的服务时使用postman会出错,解析不到正确的host

协议是http,curl,java用unirest模拟http(和postman相同的参数,代码也是postman生成的)都行,就是postman不行(No hosts are available for /svc/localhost:4140)

public static void main(String[] args) throws  Exception{
HttpResponse<String> response = Unirest.get("http://localhost:4140/")
.header("GET", "/6767 HTTP/1.1")
.header("cache-control", "no-cache")
.header("host", "web")
.header("postman-token", "4def4acc-61ad-d443-9ce5-52a3df3db501")
.asString();

System.out.println(response.getBody());
}


curl -H "Host: web" http://localhost:4140/[/code] 
后来google发现,原理是postman会屏蔽一些header的修改,在get时,设置header(Host:web)没有起作用。需要安装postman interceptor或者打开postman interceptor开关,这时设置的header才能起作用

查找结果:

Override the ‘Host’ header #781

Interceptor extension 下面Restricted Headers



enjoy service mesh!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linkerd postmanhos