标签: proxy

如何在JAVA中创建自己的代理服务器来解决CORS问题?

我确实需要在 java 中创建自己的代理服务来处理任何服务器/服务的 CORS 问题。我正在使用基于 cors-anywhere Node js 的服务来解决我的问题。

https://github.com/Rob--W/cors-anywhere

但是,现在我需要用java来提供这个服务。我的想法是,我的团队成员将 ping 此服务并提供他们的服务器 URL 作为参数,我需要充当中间人来获取响应并将其与“no-access-allow-origin”响应一起重新路由给我的团队成员标头。

java proxy cors cors-anywhere

5
推荐指数
1
解决办法
2122
查看次数

如何用node正确创建HTTPS透明代理服务器?

我正在使用 npm 包http-proxy,它声称可以帮助解决这个问题,但是我完全无法使其工作。到目前为止,我仅通过创建透明 HTTP 代理服务器取得了成功,但是当它创建透明 HTTPS 代理服务器时,什么也没有发生。

我正在使用一个 Android 设备,配置为使用代理以及预期配置代理的端口,但在 Nodejs 端没有触发任何内容。仅当我配置了 HTTP 代理服务器时,一切似乎才正常。

这是我的 HTTPS 代码:

var https = require('https');
var fs = require('fs');
var httpProxy = require('http-proxy');

var options = {
    key: fs.readFileSync('./client-key.pem', 'utf8'),
    cert: fs.readFileSync('./client-cert.pem', 'utf8')
};

var proxy = httpProxy.createProxyServer({
    ssl: options
});

https.createServer(options, function (req, res) {
    console.log("new", req.url);
    proxy.web(req, res, {
        target: req.url
    });
}).listen(8000);
Run Code Online (Sandbox Code Playgroud)

如果我使用http包中的createServer,那么它适用于http调用(因为正在触发回调),但它不适用于带有这些指令的https。有人知道我做错了什么吗?

PS:我不在乎是否必须使用不同的 npm 包。

https proxy node.js

5
推荐指数
1
解决办法
2504
查看次数

Selenium Chromedriver Python - 使用 Tor 代理加载 ModHeader 扩展时“无法等待扩展后台页面加载”

这个错误在以前运行良好的程序中突然出现。我绝对确定我没有对程序进行任何更改,因为它的功能是完美的,所以这是迄今为止我经历过的最奇怪和最令人沮丧的错误。

这是我试图执行的代码:

chrome_options.add_extension('C:\\chromedriver\\ModHeader_v (1).crx')
chrome_options.add_argument('--proxy-server=socks5://' + '127.0.0.1:9150') 
driver = webdriver.Chrome('C:\\chromedriver\\chromedriver.exe', chrome_options = chrome_options)
Run Code Online (Sandbox Code Playgroud)

这会引发以下错误:

selenium.common.exceptions.WebDriverException:消息:未知错误:无法等待扩展后台页面加载:chrome-extension://idgpnmonknjnojddfkpgkljpfnnfcklj/_ generated_background_page.html 来自超时:从渲染器接收消息超时:10.000
(驱动程序信息:chromedriver =2.24.417431(9aea000394714d2fbb20850021f6204f2256b9cf),平台=Windows NT 10.0.15063 x86_64)

我认为 Tor 浏览器中的更改导致了此错误。没有其他潜在原因。

python proxy selenium tor google-chrome-extension

5
推荐指数
1
解决办法
5335
查看次数

Kibana 5.5.1 位于 nginx 1.13 代理之后(dockerized)

目标:

我想在 docker 容器中运行 elk 堆栈。能够通过 nginx 代理访问 ELK Stack,以绕过服务的各个端口。

Kibana 服务(默认端口 5601)

http://<server>.com:5601
Run Code Online (Sandbox Code Playgroud)

应可通过以下地址访问:

http://<server>.com/kibana
Run Code Online (Sandbox Code Playgroud)

问题:

问题是,在我将 server.basePath 设置添加到配置后,无法访问 kibana 站点。只有将 Kibana 的每个基本 api 调用添加到 nginx 配置(/api、/ui、...)中,我才能启动该服务。

配置:

Kibana 的配置:

/opt/kibana/config/kibana.yml
Run Code Online (Sandbox Code Playgroud)

有以下条目:

server.host: "0.0.0.0"
server.basePath: "/kibana"
Run Code Online (Sandbox Code Playgroud)

其他一切都是默认的

多库server.basePath

# Enables you to specify a path to mount Kibana at if you are running behind a proxy. This only affects
# the URLs generated by Kibana, your proxy is expected to remove the basePath value before forwarding requests
# …
Run Code Online (Sandbox Code Playgroud)

proxy nginx docker elastic-stack kibana-5

5
推荐指数
1
解决办法
3220
查看次数

Google Maps JavaScript API 必须直接从 Google 服务器下载

我使用 Google 地图 js API,但没有直接请求它(代理限制的原因)。所以到目前为止,我有一个 php 脚本(在我的服务器中)作为中间层。所以我的index.html中有这一行: <script src="https://my-production-domain/google.php"></script>

到目前为止,一切都很完美。我从 API 得到这个响应:

Google Maps JavaScript API 必须直接从 Google 服务器下载

这个问题有什么解决办法吗?我不可能更改代理规则。

提前致谢

html javascript php proxy google-maps-api-3

5
推荐指数
0
解决办法
1061
查看次数

如何防止 Splunk SDK for Javascript 使用我的代理环境变量?

我不是 100% 确定,但我相信 splunk-sdk 正在使用我的代理环境变量。由于我们的应用程序代理的工作限制,我无法从 Node.js 访问 Splunk。我想知道如何防止 splunk-sdk 使用应用程序代理。

var splunkjs = require('splunk-sdk');

var service = new splunkjs.Service({
    username: process.env.SPLUNK_USER,
    password: process.env.SPLUNK_PW,
    scheme: 'https',
    host: 'my.splunk.server',
    port: '8089',
    autologin: true
});

var search_term = 'somethingsomethingdarkside'
var fields = 'field1,field2,field3';
var searchquery = `search index=* sourcetype=* ${search_term} | fields ${fields} | fields - _raw`
var searchParams = {
    earliest_time: '-1h',
    latest_time: 'now',
    output_mode: 'json'
}


service.oneshotSearch(searchquery, searchParams, function(err, results) {
    if (err) {
        console.log(err)
    }
    else {
        console.log(results.results);
    }
}); …
Run Code Online (Sandbox Code Playgroud)

javascript proxy splunk node.js

5
推荐指数
0
解决办法
708
查看次数

Angular 2 代理的 NPM Intellij IDEA 配置

我想将 Intellij IDEA 配置为以代理作为参数运行“单击”npm Angular 2 conf。我可以通过终端通过命令来完成此操作ng serve --proxy-config proxy.conf.json,但通过 Intellij 完成配置更容易。当我将参数粘贴到输入中时,我只得到ng serve "proxy.conf.json. 这有什么问题吗?

我当前的配置

proxy intellij-idea npm angular

5
推荐指数
1
解决办法
1286
查看次数

Python:如何使用 urllib 或从公司域(防火墙、代理、cntlm 等)请求模块

我正在尝试执行以下操作:

from urllib.request import urlopen
data = urlopen("https://www.duolingo.com/users/SaifullahS6").read()
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

URLError: <urlopen error [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>
Run Code Online (Sandbox Code Playgroud)

同样,当我尝试这样做时:

import requests
session = requests.Session()
data = {"login": "SaifullahS6", "password": "mypassword"}
req = requests.Request('POST', "https://www.duolingo.com/login", data=data,         
cookies=session.cookies)
prepped=req.prepare()
returned = session.send(prepped)
Run Code Online (Sandbox Code Playgroud)

我得到:

ConnectionError: HTTPSConnectionPool(host='www.duolingo.com', port=443): Max retries exceeded with url: /login (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000000000E6948D0>: …
Run Code Online (Sandbox Code Playgroud)

python proxy urllib python-requests

5
推荐指数
1
解决办法
4460
查看次数

apt-get 更新时出现“NOSPLIT”(网络是否需要身份验证?)

每当我这样做时:

sudo apt-get 更新

我收到以下错误:

W: GPG error: http://ppa.launchpad.net/rael-gc/rvm/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8094BB14F4E3FBBE
W: The repository 'http://ppa.launchpad.net/rael-gc/rvm/ubuntu xenial InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/xenial/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: Failed …
Run Code Online (Sandbox Code Playgroud)

ubuntu proxy networking apt

5
推荐指数
1
解决办法
2万
查看次数

ProxySelector:每个 URL 都有不同的代理

我试图了解 ProxySelector 类的工作原理。我当前的代码如下所示:

    URI uri = new URI("http://google.com");
    proxySelector.select(uri);
Run Code Online (Sandbox Code Playgroud)

据我了解,调用proxySelector.select(uri);此函数时应该返回相应 URI 的代理列表。但我不知道如何为每个 URI 设置代理。

我知道我可以使用该setDefault()方法设置默认代理,但据我了解,这将设置系统范围的代理,而不是特定URI.

我可能在这里遗漏了一些基本点,但如何为网址 A (例如http://google.com)设置一个代理并为网址 B (例如http://ebay.com)设置一个不同的代理,然后让系统每次连接到相应的url时都会自动选择正确的代理?

java proxy uri http-proxy proxyselector

5
推荐指数
1
解决办法
8344
查看次数