标签: http-proxy

activemq http代理

我需要通过HTTP/HTTPS-Proxy将ActiveMQ-Listener连接到防火墙外的代理.我到处搜索但没有找到解决方法如何为AcitveMQ-Client设置代理设置.

ActiveMQ正在使用Apache HttpClient,但我不知道如何在ActiveMQ中操纵该客户端的创建.HttpClient不使用htttps.proxyHost和https.proxyPort.

有没有办法为HttpClient的所有实例设置全局http/https代理?

java activemq-classic jms http-proxy java-ee

8
推荐指数
1
解决办法
2826
查看次数

套接字挂起错误Http-Proxy NodeJS

当用户单击"注销"按钮时,我的服务器控制台中出现以下错误.

Error: socket hang up
    at createHangUpError (http.js:1472:15)
    at Socket.socketCloseListener (http.js:1522:23)
    at Socket.EventEmitter.emit (events.js:95:17)
    at TCP.close (net.js:466:12)
Run Code Online (Sandbox Code Playgroud)

这是我的proxy_server:

var fs=require('fs');
var options = {
    key: fs.readFileSync('key/xxxxxxxxx.pem'),
    cert: fs.readFileSync('key/xxxxx.pem'),
    ca: fs.readFileSync('key/gd_bundle-g2-g1.crt')
};

var express=require('express'),
    https=require('https'),
    httpProxy = require('http-proxy'),
    http=require('http'),
    app=express(),
    app1=express(),
    server=https.createServer(options,app),
    serverhttp=http.createServer(app1);

var proxy = httpProxy.createProxy({ target: 'http://localhost:9898',secureOptions:'constants.SSL_OP_NO_TLSv1_2'});
var proxySig = httpProxy.createProxy({target:'http://localhost:8881',secureOptions:'constants.SSL_OP_NO_TLSv1_2'});
var callSig = httpProxy.createProxy({target:'http://localhost:6666',secureOptions:'constants.SSL_OP_NO_TLSv1_2'});
var proxyCdn = httpProxy.createProxy({target:'http://localhost:3030',secureOptions:'constants.SSL_OP_NO_TLSv1_2'});
// var proxyhttps= new httpProxy.createProxy({ target: 'https://localhost:443',secure:false});
var errorhandler = require('errorhandler');

app.all('*', function(req,res){
    if(req.hostname=='xxxxxxxx.in')
    {
        proxy.web(req, res); 
    }
    else if(req.hostname=='xxxx.in') …
Run Code Online (Sandbox Code Playgroud)

http-proxy node.js express socket.io

8
推荐指数
1
解决办法
3307
查看次数

如何为 kubernetes (v1.11.2) 集群设置代理设置(http_proxy 变量)?

我设置了一个 Kubernetes 集群,但由于组织政策的原因,该集群无法连接互联网。现在有一些服务需要通过互联网进行通信。为了解决这个问题,我设置了一个位于 K8s 集群外部的转发代理 (Squid)。我的 K8s 集群的所有节点都可以使用正向代理访问“google.com”。但我无法让我的 Pod 通过该代理进行通信。

我在所有主节点和工作节点上设置了以下变量:

export http_proxy="http://10.x.x.x:3128"
export https_proxy="https://10.x.x.x:3128"
Run Code Online (Sandbox Code Playgroud)

我能够从主节点和工作节点卷曲 google.com。但是当我附加到容器中时,我注意到没有变量 http_proxy 和 https_proxy。并且它无法执行成功的卷曲。

我的 Pod 和服务网络与我的 VM 网络不同

pod-network-cidr=192.167.0.0/16 
service-cidr 192.168.0.0/16 
Run Code Online (Sandbox Code Playgroud)

我的虚拟机网络如下:

Master  -> 10.2.2.40
Worker1 -> 10.2.2.41
Worker2 -> 10.2.2.42
Worker3 -> 10.2.2.43
Run Code Online (Sandbox Code Playgroud)

我的转发代理运行在

Forward Proxy: 10.5.2.30
Run Code Online (Sandbox Code Playgroud)

我使用的是 kubernetes 版本 v1.11.2。这里是否有任何帮助,例如我应该将 kubernetes 集群的 http_proxy 设置放在哪里,以使其对所有 Pod 和服务有效?

proxy squid http-proxy docker kubernetes

8
推荐指数
1
解决办法
4万
查看次数

Wordpress Rest API反向代理

我正在尝试使用wordpress设置反向代理并排除几个路径.我的排除规则适用于admin,includes,.. etc,但它不适用于/ wp-json /.我怀疑是因为.htaccess.我需要wordpress来返回其余的api数据,因为我在gatsbyjs中使用它.

我花了一整天的时间试图解决这个问题.出于某种原因,我的setup/wp-json /返回404,它被代理到我网站的前端部分所在的netlify服务器.如果我删除所有代理规则wp-json的工作原理.

.htaccess包含默认的wordpress内容.

这是我的虚拟主机的pastebin:https: //pastebin.com/vFh6hCkN

<IfModule mod_ssl.c>
   <VirtualHost *:443>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive …
Run Code Online (Sandbox Code Playgroud)

mod-proxy http-proxy wordpress-rest-api gatsby

8
推荐指数
1
解决办法
705
查看次数

python 中的 requests.get() 或 requests.post() 无法连接到代理错误

我有两个 URL 可以从中获取数据。使用我的代码,第一个 URL 有效,而第二个 URL 给出ProxyError.

我正在requestsPython 3 中使用库,并尝试在 Google 和此处搜索问题,但没有成功。

我的代码片段是:

    import requests

    proxies = {
      'http': 'http://user:pass@xxx.xxx.xxx.xxx:xxxx',
      'https': 'http://user:pass@xxx.xxx.xxx.xxx:xxxx',
    }

    url1 = 'https://en.oxforddictionaries.com/definition/act'
    url2 = 'https://dictionary.cambridge.org/dictionary/english/act'

    r1 = requests.get(url1, proxies=proxies)
    r2 = requests.get(url2, proxies=proxies)
Run Code Online (Sandbox Code Playgroud)

url1工作正常,但url2出现以下错误:

    ProxyError: HTTPSConnectionPool(host='dictionary.cambridge.org', port=443): Max retries exceeded with url: /dictionary/english/act (Caused by ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response',)))
Run Code Online (Sandbox Code Playgroud)

使用时也会发生同样的情况request.post()

  1. 请解释一下为什么会发生这种情况,以及两个 URL 的握手之间有什么区别吗?

  2. urllib.request.urlopen工作正常,所以我明确使用以下方式寻找答案requests

python proxy request http-proxy python-requests

8
推荐指数
1
解决办法
3万
查看次数

尝试使用代理模拟HttpClient时出现WireMock错误

我有一个Http Client,它在现实生活中使用代理将请求发送到API。我正在尝试使用WireMock运行我的http客户端测试并模拟API的响应。但是,我无法使Wiremock与代理设置一起使用。我已经尝试了所有相关组合,但仍然无法通过成功的测试。

我尝试了viaProxy配置,proxiedWith但是也不确定我是否正确使用它们。该文档也无济于事。

客户端代码具有以下配置:

private val httpsProxySettings: ConnectionPoolSettings =
    ConnectionPoolSettings(actorSystem)
      .withConnectionSettings(ClientConnectionSettings(actorSystem))
      .withTransport(
        ClientTransport.httpsProxy(
          InetSocketAddress.createUnresolved(PROXY_HOST, PROXY_PORT)
        )
      )
Run Code Online (Sandbox Code Playgroud)

测试配置大致如下:

      val wireMockServer = new WireMockServer(
        wireMockConfig().port(API_PORT).proxyVia(PROXY_HOST, PROXY_PORT)
      )
      wireMockServer.start()
      WireMock.configureFor("localhost", API_PORT)

      wireMockServer.stubFor(
        put(anyUrl())
          .willReturn(
            aResponse()
              .withStatus(201)
//            .proxiedFrom(API_HOST)
          )
      )
Run Code Online (Sandbox Code Playgroud)

integration-testing scala http-proxy wiremock akka-http

8
推荐指数
1
解决办法
139
查看次数

如何在 vue-cli 应用程序中正确设置用于 WebSocket 代理的 devServer

我有一个 Node.JS 服务器在http://localhost:8080上运行,有 2 条路由:

\n
    \n
  • "/":服务于/public/index.html
  • \n
  • "/rest":返回{ ok: true }
  • \n
\n

该服务器还在同一端口上运行 Websocket 连接。在index.html中,我使用const socket = new WebSocket("ws://" + window.location.host).

\n

当我运行此服务器并访问http://localhost:8080时,以下工作正常:

\n
    \n
  • 提供索引:是 \xe2\x9c\x85
  • \n
  • 返回 JSON:是 \xe2\x9c\x85
  • \n
  • WebSocket 消息传递:是 \xe2\x9c\x85
  • \n
\n
\n

此外,我还在开发模式下在http://localhost:8079运行vue-cli应用程序,并使用以下vue.config.js配置:

\n
...\ndevServer: {\n  port: 8079,\n  "/": {\n    target: "http://localhost:8080/",\n    ws: true\n  },\n}\n
Run Code Online (Sandbox Code Playgroud)\n

当我运行此应用程序并访问http://localhost:8079 时,会发生以下情况:

\n …

connection http-proxy websocket node.js

8
推荐指数
1
解决办法
6527
查看次数

如何使用默认的 Web 代理设置在 R 中配置 curl 包?

我在商业环境中使用 R,其中外部连接全部通过 Web 代理进行,因此我们需要指定代理服务器地址并确保我们使用 Windows 身份验证连接到它。

我已经有了将 RCurl 和 httr 包配置为默认使用这些设置的代码 - 即

httr::set_config(config(
  proxy = "my.proxy.address", 
  proxyuserpwd = ":", 
  proxyauth = 4
   ))
Run Code Online (Sandbox Code Playgroud)

或者

opts <- list(
  proxy = "my.proxy.address",
  proxyuserpwd = ":", 
  proxyauth = 4
)
RCurl::options(RCurlOptions = opts)
Run Code Online (Sandbox Code Playgroud)

但是,在最近的几个案例中,我发现依赖curl包来发出 Web 请求的包 - 例如xml2::read_xml- 我找不到任何方法来设置相同的代理选项,因此默认情况下它们会被选中并由 curl 使用。

如果我自己直接使用 curl,我可以在新句柄上设置选项,以下代码足以成功工作:

  h = new_handle(proxy = "my.proxy.address",
                 proxyuserpwd = ":")
  con = curl(url,handle = h)
  page = xml2::read_xml(con)
Run Code Online (Sandbox Code Playgroud)

...但是当 curl 的使用被埋在其他人的功能中时,这没有任何帮助!

或者,我知道我可以为代理地址设置一个环境变量,如下所示:

Sys.setenv(https_proxy = "https://my.proxy.address")
Run Code Online (Sandbox Code Playgroud)

... libcurl …

curl r http-proxy xml2

7
推荐指数
1
解决办法
2301
查看次数

无法通过 Apple Configurator 2 在 Apple TV 上安装 Charles Proxy 配置文件

我一直在尝试使用此官方指南在我的 Apple TV(第 4 代,运行 tvOS 13.3)上设置 Charles Proxy。在 Apple Configurator 2 上创建配置文件后,我正在执行以下在 Apple TV 上设置配置文件的步骤:

安装配置文件屏幕 在此处输入图片说明 在此处输入图片说明

按上面的“完成”后,显示此屏幕表示尚未安装配置文件:

在此处输入图片说明

您能指导我如何在运行 tvOS 13.3 的 Apple TV 上成功安装 Charles Proxy 配置文件吗?

http-proxy apple-tv apple-configurator tvos charles-proxy

7
推荐指数
1
解决办法
1204
查看次数

Node JS HTTP 代理挂断

我有一个 http 代理来代理任何网站,并在将 HTML 返回给客户端之前注入一些自定义 JS 文件。每当我尝试访问代理网站时,它都会挂断或浏览器似乎无法确定加载。但是当我检查 HTML 源代码时,我成功地注入了我的自定义 JavaScript 文件。这是代码:

const cheerio = require('cheerio');
const http = require('http');
const httpProxy = require('http-proxy');
const { ungzip } = require('node-gzip');

_initProxy(host: string) {
    let proxy = httpProxy.createProxyServer({});
    let option = {
        target: host,
        selfHandleResponse: true
    };

    proxy.on('proxyRes', function (proxyRes, req, res) {
        let body = [];
        proxyRes.on('data', function (chunk) {
            body.push(chunk);
        });
        proxyRes.on('end', async function () {
            let buffer = Buffer.concat(body);
            if (proxyRes.headers['content-encoding'] === 'gzip') {
                try {
                    let $ = …
Run Code Online (Sandbox Code Playgroud)

javascript reverse-proxy http-proxy node.js node-http-proxy

7
推荐指数
1
解决办法
950
查看次数