大家好,我正在安装 squid 作为 HTTP 代理,用于使用工具从 google 抓取 url 我已经配置了所有东西,但是当我连接到 squid 时,它给出了 tcp 403 错误我有 ubuntu14.04 并且我没有更改其默认设置只是更改HTTP_access 拒绝所有允许并且所有都相同我想使用该代理进行抓取目的应该是它的配置文件,请帮助我搜索超过 2 天的内容。
http_port 3128
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
acl localnet src 10.0.0.0/8 # RFC 1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC 1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC 1918 possible internal network
acl localnet src fc00::/7 # RFC 4193 local …Run Code Online (Sandbox Code Playgroud) 查尔斯代理或其他工具中是否有任何选项,我可以保存/缓存所有请求,下次当相同请求出现时,它返回相同的响应而不转发请求。
我正在使用 John Papa 的 lite 服务器和 chimurai 的 HTTP 代理中间件作为开发服务器。问题出在我的会话 cookie 上,我无法保留来自真实服务器的会话 cookie。我看到了这个解决方案:https : //github.com/chimurai/http-proxy-middleware/issues/78
但我发现与我的 bs-config.js 没有相似之处:
var proxy = require('http-proxy-middleware');
module.exports = {
port: 3003,
server: {
middleware: {
1: proxy('demo/webservice/jaxrs', {
target: 'https://localhost:8443',
secure: false, // disable SSL verification
changeOrigin: true // for vhosted sites, changes host header to match to target's host
}),
2: require('connect-history-api-fallback')({index: '/index.html', verbose: true})
}
}
};
Run Code Online (Sandbox Code Playgroud)
有人知道如何合并这两个吗?
更新:这是响应标头的一部分:
set-cookie:JSESSIONID=620083CD7AEB7A6CC5772AC800E673E3; Path=/appServer/webservice/jaxrs; Secure
strict-transport-security:max-age=31622400; includeSubDomains
Transfer-Encoding:chunked
Run Code Online (Sandbox Code Playgroud)
UPDATE2:我认为我的配置应该是这样的:
var proxy = require('http-proxy-middleware');
function …Run Code Online (Sandbox Code Playgroud) 我正在将弹性 beantalk与ngnix代理服务器一起使用。我的应用程序代码在 node.js express框架上。我正在尝试通过以下代码访问客户端 IP
var ip = event.headers['x-forwarded-for'] ||
event.connection.remoteAddress ||
event.socket.remoteAddress ||
event.connection.socket.remoteAddress;Run Code Online (Sandbox Code Playgroud)
但我总是为所有传入的请求获得相同的客户端 IP。我认为这将是代理服务器的 IP 地址。
如何从我的应用程序访问真实的客户端地址???
http-proxy amazon-web-services node.js amazon-elastic-beanstalk
我正在尝试开发一个代理服务器,该服务器将通过在代理中的该会话上设置 cookie 来帮助客户端在没有密码的情况下自动登录到我的应用程序。这意味着如果用户使用代理访问该站点,那么他将使用在该流量上设置的 cookie 自动登录到该站点。
我已经在 centos 6.8 x64 上安装并配置了 SQUID。设置完所有内容并使用后
request_header_add Cookie name=value
Run Code Online (Sandbox Code Playgroud)
在 /etc/squid/squid.conf 中。
cookie 设置为所有 HTTP 流量,但我的应用程序使用 HTTPS。因此,我尝试设置 OpenSSl、ssl-bump 以及所有有关 SSL 的设置,包括 ip 表
这是我的 squid.conf 的样子:
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports …Run Code Online (Sandbox Code Playgroud) 我正在编写一个内部使用 WireMock 的 HTTP 记录播放代理,并且在记录 HTTPS 目标时遇到了问题。HTTP 站点工作正常。
以下是我为未加密站点设置 WireMock 代理的方法:
java \
-jar /var/proximate/wiremock-standalone-2.4.1.jar \
--port 9000 \
--proxy-all http://ilovephp.jondh.me.uk \
--record-mappings \
--root-dir /remote/experiment/record/http
Run Code Online (Sandbox Code Playgroud)
然后我可以使用以下命令在该站点上记录任何内容:
wget -e use_proxy=yes -e http_proxy=proximate-proxy:9000 \
http://ilovephp.jondh.me.uk/en/tutorial/make-your-own-blog
Run Code Online (Sandbox Code Playgroud)
很快,我将获得一些自动创建的映射:
/ # ls -R /remote/experiment/record/http
/remote/experiment/record/http:
__files mappings
/remote/experiment/record/http/__files:
body-tutorial-make-your-own-blog-tWrNm.txt
/remote/experiment/record/http/mappings:
mapping-tutorial-make-your-own-blog-tWrNm.json
Run Code Online (Sandbox Code Playgroud)
这是大致相同的事情,但在 SSL 站点上。先代理:
java \
-jar /var/proximate/wiremock-standalone-2.4.1.jar \
--port 9000 \
--proxy-all https://www.rottentomatoes.com/ \
--record-mappings \
--root-dir /remote/experiment/record/https \
--verbose
Run Code Online (Sandbox Code Playgroud)
这是获取:
wget -e use_proxy=yes -e http_proxy=proximate-proxy:9000 \
https://www.rottentomatoes.com/
Run Code Online (Sandbox Code Playgroud)
WireMock 的结果是创建了内部缓存目录,但它们不包含任何内容:
/ # ls …Run Code Online (Sandbox Code Playgroud) 我有一个项目,它使用 angular 作为前端,后端有一个 Laravel API。我想利用 ng serve 的代理实时重新加载:
ng serve --proxy-config proxy.config.js
Run Code Online (Sandbox Code Playgroud)
这是 proxy.config.js 文件:
const PROXY_CONFIG = {
"/v2/*": {
"target": "http://local-laravel-api/",
"secure": false,
"pathRewrite": {
"^/v2": "/v2"
},
"logLevel": "debug",
"changeOrigin": true
}
}
module.exports = PROXY_CONFIG;
Run Code Online (Sandbox Code Playgroud)
Laravel API 具有身份验证。当我访问 localhost:4200 时,我得到“Not Authenticated”,这是因为在通过代理时浏览器中未设置 auth cookie。
如果我直接访问 API(在浏览器中访问 local-laravel-api),cookie 存在并且我通过了身份验证。
所以基本上,代理似乎没有接收 cookie(我不知道为什么)。
我在网上看到多个线程讨论相同的问题,我已经用尽了所有这些,但仍然无法访问 API。
有没有人有任何想法可以阐明这个问题?
任何帮助是极大的赞赏!
当我通过 HTTPS 和/或使用 HTTP 代理访问站点时,Linux 中的 cURL 提供-v/--verbose标志来显示CONNECT对代理的请求,以及 SSL/TLS 握手过程(包括证书),例如
* Rebuilt URL to: https://www.example.com/
* Trying 192.168.2.1...
* Connected to my-proxy.local (192.168.2.1) port 8080 (#0)
* Establish HTTP proxy tunnel to www.example.com:443
> CONNECT www.example.com:443 HTTP/1.1
> Host: www.example.com:443
> User-Agent: curl/7.47.0
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 Connection established
<
* Proxy replied OK to CONNECT request
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 597 certificates in /etc/ssl/certs
* ALPN, …Run Code Online (Sandbox Code Playgroud) 我需要通过代理中继 C# Graph-Sdk 发出的 HTTP 请求。
在文档中,我找不到有关代理设置的任何信息。我目前找到的唯一解决方法是更改全局代理设置:
System.Net.GlobalProxySelection.Select = proxy;
or
System.Net.WebRequest.DefaultWebProxy = proxy;
Run Code Online (Sandbox Code Playgroud)
可悲的是,在我的情况下,如果不将所有与图形相关的功能移动到一个单独的进程中,这是不可能的(因为主进程的其余部分需要在没有代理的情况下运行)。
所以我的问题是:
sdk 中是否有对代理设置的官方支持?
是否计划为未来的 sdk 版本支持代理设置?
我想用 http-proxy-middleware 和 express 配置代理。规则是主机名的映射,例如:
http://123.com >> http://localhost:3000/123
http://456.com >> http://localhost:3000/abc
Run Code Online (Sandbox Code Playgroud)
我试过这样:
import express from 'express';
import http from 'http';
import proxy from 'http-proxy-middleware';
const app = express();
app.use( async function (req, res) {
let direction = 'http://localhost:3000';
console.log('hostname: ', req.hostname);
console.log('originalUrl: ', req.originalUrl);
if (req.hostname == '123.com') {
direction = `http://localhost:3000/123${req.originalUrl}`;
}
if (req.hostname == '456.com') {
direction = `http://localhost:3000/abc${req.originalUrl}`;
}
return await proxy({ target: direction, changeOrigin: false })
});
const server = http.createServer(app);
app.set('port', '127.0.0.1');
server.listen(9999, '0.0.0.0');
Run Code Online (Sandbox Code Playgroud)
但它不起作用。
http-proxy ×10
angular ×2
cookies ×2
node.js ×2
proxy ×2
squid ×2
ssl ×2
browser-sync ×1
c# ×1
https ×1
java ×1
javascript ×1
laravel ×1
lite-server ×1
powershell ×1
ubuntu ×1
ubuntu-14.04 ×1
webproxy ×1
wiremock ×1