邮递员无法到达本地主机 [英] Postman can't reach localhost

查看:108
本文介绍了邮递员无法到达本地主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在公司环境中,因此必须使用代理来访问服务器。这在邮递员和浏览器中效果很好。我无法到达的是邮递员中的localhost,但是我可以在浏览器中到达localhost。

I am in a corporate env so I have to use a proxy to reach servers. This works well in postman and in browsers. What I can't reach is localhost in postman but I can reach localhost in the browser.

我正在运行Postman for Linux Version 6.0.9。我尝试使用全局代理和系统代理都已打开以及已打开和未打开的状态到达localhost:9082 / rest / myapi ....和127.0.0.1:9082/rest/myapi。在所有情况下,我都无法访问本地主机。

I am running Postman for Linux Version 6.0.9. I have tried reaching localhost:9082/rest/myapi.... and 127.0.0.1:9082/rest/myapi with both global proxy and system proxy turned on and with either turned on and with non turned on. In all cases I am not able to reach localhost.

作为响应,我得到的是来自代理服务器的错误页面!某种程度上,呼叫从网络上发出,而不是保留在我的机器上。

What I get as an response is an error page from the proxy server! Someway the call gets out on the network instead of being kept on my machine.

邮递员控制台:

我的请求标头是:

Cache-Control →no-cache
Connection →Keep-Alive
Content-Length →986
Content-Type →text/html; charset=utf-8
Pragma →no-cache
Proxy-Connection →Keep-Alive

我的响应标头是:

cache-control:"no-cache"
pragma:"no-cache"
content-type:"text/html; charset=utf-8"
proxy-connection:"Keep-Alive"
connection:"Keep-Alive"
content-length:"986"

我的回复正文是HTML页面。

My response body is an html page.

如何与邮递员通话 localhost

推荐答案

我找到了一个临时解决方案:

I found a temporary solution:

在终端中,转到安装邮递员的目录并添加:

In terminal, go to the directory where postman is installed and add:

machine@dev:~/Documents/Postman$ export NO_PROXY=localhost,127.0.0.1
machine@dev:~/Documents/Postman$ ./Postman 

这将使对本地主机的调用正常工作。

This will make calls to localhost work.

我在Windows计算机上发现了类似的问题此处

I found a similar problem on Windows machines here

这篇关于邮递员无法到达本地主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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