我们正在使用nginx来将请求负载平衡到我们的应用程序。 我们发现当请求超时(好)时,nginx会切换到不同的上游服务器。 但是,它会对PUT和POST请求造成不良影响(数据存储两次)。 是否有可能configurationnginx只在超时重试GET请求? 还是有另一种方法来解决这个问题? 我们的configuration如下: upstream mash { ip_hash; server 127.0.0.1:8081; server 192.168.0.11:8081; } server { … location / { proxy_pass http://mash/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
我正在尝试configurationnginx,以便对我的节点应用程序进行proxy_pass请求。 StackOverflow的问题得到了许多upvotes: https ://stackoverflow.com/questions/5009324/node-js-nginx-and-now,我使用从那里的configuration。 (但由于问题是关于服务器configuration,它应该是在ServerFault上) 这里是nginxconfiguration: server { listen 80; listen [::]:80; root /var/www/services.stefanow.net/public_html; index index.html index.htm; server_name services.stefanow.net; location / { try_files $uri $uri/ =404; } location /test-express { proxy_pass http://127.0.0.1:3002; } location /test-http { proxy_pass http://127.0.0.1:3003; } } 使用普通节点: var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(3003, […]
希望你们可以帮我解决我的代理问题。 我已经有了 我已经build立了一个Apache的HTTP反向代理,以代理从* .proxy.domain到* .intern.domain的请求。 Apache是从外部networking访问我的内部Web应用程序的唯一方法。 例: app.proxy.domain -> app.intern.domain mail.proxy.domain -> mail.intern.domain 这一切都很好,但我有以下问题。 问题 我想代理下面的请求: app.proxy.domain -> app.internal.domain app-dev.proxy.domain -> app-dev.internal.domain 这是没有问题的,但不幸的是,应用程序开发服务器运行应用程序服务器web应用程序的确切副本,这个web应用程序只响应它的主机名(app.intern.domain) 所以我需要做的是代理以下 app.proxy.domain -> app.internal.domain (10.0.1.1) app-dev.proxy.domain -> app.internal.domain (10.0.1.2) 我可以做第二件事,通过在/ etc / hosts中添加“10.0.1.2 app.internal.domain”,但这也意味着app.proxy.domain将落在开发服务器上。 我正在寻找一个选项,只在app-dev.proxy.domain的vhostconfiguration文件中设置/ etc / hosts项,这样每个其他的vhostconfiguration将只使用DNS作为app.intern.domain。 思考… 有没有办法告诉Apacheconfiguration, ProxyPass / http://10.0.1.2/ 但发送app.intern.domain作为主机名? 编辑开发服务器的Web应用程序来听应用程序开发是没有select,因为它应该是一个确切的副本(不是我的决定…) 谢谢!
我有一个虚拟主机设置为redirectntung-gitblit.localhost – > myserver:1279 。 但是,它不能使用正向编码的斜线( %2f )。 我试图访问的URL是, http://ntung-gitblit.localhost/ABC%2fXYZ 如果没有AllowEncodedSlashes ,它会失败/error/HTTP_NOT_FOUND.html.var尝试访问服务器上的/error/HTTP_NOT_FOUND.html.var 。 将AllowEncodedSlashes设置为On导致以下内部URL匹配, http://myserver:1279/ABC/XYZ 并将AllowEncodedSlashes设置为NoDecode结果在下面的URL被击中, http://myserver:1279/ABC%252fXYZ 换句话说,它是过度逃避或逃避。 问题 :如何使它命中myserver:1279/ABC%2fXYZ ?
我使用nginx作为反向代理服务于仅限https的站点。 所以我想这个网站的cookies被标记为安全的。 但后端服务器是一个http,所以它不会将安全标志设置为它的cookie。 如何修改Set-Cookie头以响应添加安全标志?
这是关于主机名感知和代理的一个典型问题 。 我知道一些协议是主机名知道的; 也就是说,当我连接到www.example.com的HTTP服务器时,它知道我想要www.example.com的HTTP服务,而不是www.example.net ,即使它们在同一个IP地址上。 我怎样才能做到这一点协议foo ? (暂时的注意:这个问题出现在这个元讨论中 。)
我有nginx被configuration为我的外部可见的networking服务器,通过HTTP与后端通话。 我想要实现的场景是: 客户端向nginx发送HTTP请求,nginx将通过HTTPSredirect到相同的URL nginx代理请求通过HTTP到后端 nginx通过HTTP接收来自后端的响应。 nginx通过HTTPS将其传递回客户端 我当前的configuration(后端configuration正确)是: 服务器{ 听80; server_name localhost; 位置〜。* { proxy_pass http://后端; proxy_redirect http://后端https:// $ host; proxy_set_header主机$主机; } } 我的问题是对客户端(步骤4)的响应是通过HTTP而不是HTTPS发送的。 有任何想法吗?
我在nginx上有一个反向代理,代理了很多站点。 我最近为所有启用SSL的网站启用了HTTP严格传输安全性。 我现在有一个网站,不希望启用此function。 我想我只是做一个简单的检查,如果我的上游已经给我一个Strict-Transport-Security标题,如果没有,只需添加一个。 这样,我的上游可以发送一个包含max-age=0的STS头,以避免代理启用HSTS。 我想我只是改变我的configuration如下: location / { proxy_pass http://webservers; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto "https"; if ($upstream_http_strict_transport_security = "") { add_header Strict-Transport-Security "max-age=15552000"; } } 但是,可能是因为如果是邪恶 ,这是行不通的。 我已经尝试了一堆不同的东西,以确保variables实际存在(这是这种情况),但似乎没有任何帮助。 我怎么能做这个工作?
我有一个服务器,作为networking中的cPanel邮件服务器的前端。 前端服务器上的apache代理运行了152天,没有任何错误,现在突然间我用500/502的错误来访问邮件服务器的webmail客户端。 前端服务器使用签名的SSL证书,cPanel服务器使用自签名证书。 这是前端服务器首次启动时的错误日志输出: [Tue Sep 10 18:22:52.959291 2013] [proxy:error] [pid 19531] (502)Unknown error 502: [client 173.xx.xx.xx:9558] AH01084: pass request body failed to 184.xx.xx.xx:2096 (184.xx.xx.xx), referer: https://domain.com:2096/cpsess12385596/3rdparty/roundcube/?_task=mail&_refresh=1&_mbox=INBOX [tue Sep 10 18:22:52.959469 2013] [proxy:error] [pid 19531] [client 173.xx.xx.xx:9558] AH00898:SSL握手过程中由于/ cpsess12385596 / 3rdparty / roundcube / ,referer: https ://domain.com:2096/cpsess12385596/3rdparty/roundcube/ ? _task = mail & _refresh =1& _mbox […]
我设置了Apache来代理tomcat,但是当我定位页面时出现以下错误。 我有时会得到一个空白页面或503: [错误] [Mon Dec 03 04:58:16 2012] [error] proxy: ap_get_scoreboard_lb(2) failed in child 29611 for worker proxy:reverse [Mon Dec 03 04:58:16 2012] [error] proxy: ap_get_scoreboard_lb(1) failed in child 29611 for worker https://localhost:8443/ [Mon Dec 03 04:58:16 2012] [error] proxy: ap_get_scoreboard_lb(0) failed in child 29611 for worker http://localhost:8080/ 我在vm上configuration了两个虚拟主机,如下所示: [http主机] <VirtualHost *:80> ServerName www.mysite.net ServerAlias […]