通过代理连接到localhost重定向

时间:2017-04-21 20:22:43

标签: rest api tomcat proxy postman

我正在尝试使用Postman在本地托管的Tomcat服务器上调用端点。但是,当我拨打电话时:

localhost:9000/api/postMethod

它通过公司代理重定向我的请求。

我在Postman中看不到任何选项,我尝试删除互联网选项中的代理设置,但问题仍然存在。

当我查看邮递员控制台时,我会看到以下内容。为什么要将代理授权和代理连接发送到localhost?

Request Headers:
cache-control:"no-cache"
Postman-Token:"{token}"
User-Agent:"PostmanRuntime/3.0.11-hotfix.2"
Accept:"*/*"
accept-encoding:"gzip, deflate"
proxy-authorization:"Basic {auth}"
referer:"http://localhost:9000/api/postMethod"

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

3 个答案:

答案 0 :(得分:0)

我有我的http_proxy系统环境变量集。我删除它并重新启动Postman后,看起来它正在工作。

答案 1 :(得分:0)

您必须设置以下环境变量(我在.bashrc文件中设置):

$ env | grep PROXY
HTTP_PROXY=myProxy:9999
HTTPS_PROXY=myProxy:9999
NO_PROXY=localhost,127.0.0.1

然后,您必须在“代理设置”部分中告诉Postman使用系统代理。这很令人讨厌,因为您可以在设置中设置代理,但不能不设置代理主机。

答案 2 :(得分:0)

如果您滞留在公司代理或类似代理之后,并且使用的是自动代理配置,该配置不允许您连接到import React, { useEffect } from "react"; import { connect } from "react-redux"; import { getEmail } from "/emailActions"; import { Link } from "react-router-dom"; const EmailModal = ({ emails, getEmail, match }) => { useEffect(() => { const id = match.params.id; getEmail(id); }, []); return ( <div> <Link to="/dashboard/someMails">Back to emails</Link> <h4>Message: {emails.currentEmail.message}</h4> <h4>Read:{"" + emails.currentEmail.read}</h4> </div> ); }; const mapStateToProps = state => { return { emails: state.emails }; }; const mapDispatchToProps = dispatch => { return { getEmail: id => { dispatch(getEmail(id)); } }; }; export default connect( mapStateToProps, mapDispatchToProps )(EmailModal); 地址,这对我有帮助:

在客户端应用程序中尝试使用IP地址而不是localhost作为主机名,例如localhost