我们正在为不同的客户端安装一些在 Nginx 后面运行 Tomcat 6 的应用程序。其中一些安装仅适用于 HTTP,有些仅适用于 HTTPS,或者两者兼而有之。由于缺少公共 IP,其中一个安装的 HTTP 和 HTTPS 在非标准端口(8070 和 8071)上运行。手头的应用程序在另一个应用程序中显示为 iframe。
Tomcat 将所有 HTTPS 请求重定向到 HTTP(因此由于浏览器对混合内容的限制,iframe 中不会显示任何内容)。
框架代码:
<iframe src="/saiku-ui">
Run Code Online (Sandbox Code Playgroud)
Tomcat的server.xml:
<Connector port="8080" protocol="HTTP/1.1"/>
<!-- A bit later... -->
<Valve className="org.apache.catalina.valves.RemoteIpValve"
remoteIpHeader="x-forwarded-for"
protocolHeader="x-forwarded-proto"
/>
Run Code Online (Sandbox Code Playgroud)
Nginx虚拟主机:
server {
listen 80;
listen 443 ssl spdy;
location /saiku-ui {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://saiku-server; # This is upstream name
proxy_redirect off;
}
}
upstream …Run Code Online (Sandbox Code Playgroud) 我在 nginx.conf 文件中有两个不同的 server_name:
第一个为:
server_name ~^(?<subdomain>.+)\.nithinveer\.com$;
location /
{
proxy_pass http://192.168.6.190/Profiles/$subdomain/default.aspx$request_uri/;
access_log /var/log/nginx/true.log;
}
Run Code Online (Sandbox Code Playgroud)
另一个作为
server_name ~^(?<subdomain>.+)\.nithinveer\.com\.(?<extension>)$;
location /extension
{
proxy_pass http://192.168.6.190;
access_log /var/log/nginx/false.log;
}
Run Code Online (Sandbox Code Playgroud)
现在的问题是我想同时使用基于 server_name 中的 server_name。如果 server_name 没有扩展名,它应该转到第一个位置。如果有分机,它应该转到第二个位置。
但是在运行 nginx 时,它并没有进入第二个 server_name
任何人都可以为此找到一些解决方案......?
我认为一个解决方案(可能是错误的)。
server_name ~^(?<subdomain>.+)\.nithinveer\.com\.(?<extension>.+)$;
if($<extension> == NULL)
{
location /
{
proxy_pass http://192.168.6.190/Profiles/$subdomain/default.aspx$request_uri/;
access_log /var/log/nginx/true.log;
}
}
else
{ location /
{
proxy_pass http://192.168.6.190;
access_log /var/log/nginx/false.log;
}
Run Code Online (Sandbox Code Playgroud)
但是带有 if 语句的语法会引发错误。
我有一台运行 kibana 的服务器,我已将其设置为从本地主机访问。这是一个 linux 服务器,所以我可以这样做:
links http://localhost:5601
Run Code Online (Sandbox Code Playgroud)
这运行良好。我需要将此 kibana 服务器置于 HAProxy 之后,它将充当 Kibana 的反向代理。
我的 Haproxy 配置文件(/etc/haproxy/haproxy.cfg)看起来像
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
# Default SSL material locations
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
# Default ciphers to use on SSL-enabled listening sockets.
# For more information, see ciphers(1SSL). This list is from:
# https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
ssl-default-bind-options no-sslv3
defaults
log global
mode …Run Code Online (Sandbox Code Playgroud) 在代理 php-fpm 时 FilesMatch 和 ProxyPassMatch 是否可以互换,如果是这样,是否有任何情况下会使用一个而不是另一个?
目前,根据许多在线教程,我正在通过 vhost 块使用 ProxyPassMatch。
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php-fpm/php-fpm.sock|fcgi://127.0.0.1:9000/"
</FilesMatch>
<Proxy "fcgi://127.0.0.1:9000/" enablereuse=on max=10>
Run Code Online (Sandbox Code Playgroud)
对比
ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/var/run/php-fpm/php-fpm.sock|fcgi://127.0.0.1:9000/
Run Code Online (Sandbox Code Playgroud) 在 Go 中,我使用 NewSingleHostReverseProxy 来执行反向代理,但是我需要确认主机站点的 SSL 证书,以确保我拥有正确的安全证书......我应该怎么做?我应该与处理程序或运输工具一起做吗?我是 Go 的新手,但仍然对它有所了解。
proxy := httputil.NewSingleHostReverseProxy(&url.URL{
Scheme: "https",
Host: "sha256.badssl.com",
})
http.ListenAndServe("127.0.0.1:80", proxy)
Run Code Online (Sandbox Code Playgroud) 我正在使用 Keycloak 2.3.0 版本、独立模式、服务器。我为在 localhost:8080 上运行的本地 Keycloak 服务器配置了 IIS URL Rewrite。
问题是无法在 Keycloak 中指定基本 url,而是 Keycloak 尝试检测自己的主机/端口并始终将端口号 (8080) 附加到重定向。我修复了配置 json 中除“auth-server-url”之外的所有内容。有什么办法让它工作吗?
我正在尝试将 IIS 与应用程序请求路由一起用作在同一主机上运行的 Jenkins 实例的反向代理。主机正在运行 Windows Server 2016(服务器核心)。
Jenkins 在 localhost:8080 上运行,而默认 IIS 站点(我用作反向代理站点)在 10.0.0.84:80 我已经设法按照本教程进行URL 重写,但它不适用于 Jenkins ' CSRF 支持并将报告 403,由于“Crumb”不存在。
我假设我需要某种传出重写规则才能使其正常工作。我已经在互联网上搜索并没有找到其他人可以使用它。
我已经在这里和互联网上进行了大量浏览,但我无法将我的 apache 配置为将 https 反向代理到 http。然而,我觉得我很接近。我遵循的所有示例似乎都适用于除我之外的所有人,而且我的设置非常简单。
<VirtualHost *:443>
ServerName myserver
SSLEngine On
SSLCertificateFile /path/to/file
SSLCertificateKeyFile /path/to/file
SSLCertificateChainFile /path/to/file
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
AddDefaultCharset Off
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://myserver:8081/
ProxyPassReverse / http://myserver:8081/
ErrorLog logs/myserver-error_log
CustomLog logs/myserver-access_log common
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
因此,当我转到https://myserver/ 时,我希望它重定向到运行 Nexus 的那个端口。
在我做 SSL 之前,这实际上适用于 VirtualHost *:80。我可以访问http://myserver/并最终访问 Nexus。不知道为什么 https 不起作用。
实际发生的是https://myserver/转到https://myserver并显示我在 DocumentRoot 中设置的测试 index.html。
我在Traefik-Installation下设置了一个Dockerized Jira-Instance。
这是我的 docker-compose.yml:
version: "2"
services:
software:
image: cptactionhank/atlassian-jira-software:latest
labels:
- "traefik.frontend.rule=Host:jira.domain.com"
- "traefik.port=8080"
- "traefik.enable=true"
- "traefik.frontend.entryPoints=http,https"
Run Code Online (Sandbox Code Playgroud)
我的 Jira-Baseurl 设置为https://jira.domain.com,我也可以使用https. 在我的 traefik 设置中,我在每个请求上都设置了从 http 到 https 的重定向。
我的 traefik.toml 看起来像这样:
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
defaultEntryPoints = ["http", "https"]
Run Code Online (Sandbox Code Playgroud)
这是有效的,但根据某些请求,我收到以下错误:
混合内容:“ https://jira.domain.com/secure/Dashboard.jspa ”页面已通过 HTTPS 加载,但请求了不安全的资源“ http://jira.domain.com/plugins/servlet/gadgets/ ifr?container=atlassian&mi ...ivitystream-gadget%2Fgadgets%2Factivitystream-gadget.xml&libs=auth-refresh'。此请求已被阻止;内容必须通过 HTTPS 提供。
我已经读到我必须设置我的代理,但我不知道如何做到这一点。
我正在尝试在代理路径的每一层实现 HTTPS 协议通信。我的代理路径是从客户端到负载均衡器 (nginx),然后从 nginx 到上游服务器。
当请求从 nginx 代理到上游服务器时,我遇到了问题。
我在 nginx 日志中收到以下错误
2017/03/26 19:08:39 [error] 76753#0: *140 upstream SSL certificate does not match "8ba0c0da44ee43ea894987ab01cf4fbc" while SSL handshaking to upstream, client: 10.191.200.230, server: abc.uscom-central-1.ssenv.opcdev2.oraclecorp.com, request: "GET /a/a.html HTTP/1.1", upstream: "https://10.240.81.28:8001/a/a.html", host: "abc.uscom-central-1.ssenv.opcdev2.oraclecorp.com:10003"
Run Code Online (Sandbox Code Playgroud)
这是我对上游服务器块的配置
upstream 8ba0c0da44ee43ea894987ab01cf4fbc {
server slc01etc.us.oracle.com:8001 weight=1;
keepalive 100;
}
proxy_pass https://8ba0c0da44ee43ea894987ab01cf4fbc;
proxy_set_header Host $host:10003;
proxy_set_header WL-Proxy-SSL true;
proxy_set_header IS_SSL ssl;
proxy_ssl_trusted_certificate /u01/data/secure_artifacts/ssl/trusted_certs/trusted-cert.pem;
proxy_ssl_verify on;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Run Code Online (Sandbox Code Playgroud)
当请求从 Nginx 发送到上游服务器时,nginx 将上游 ssl 证书与 proxy_pass 指令中存在的模式进行匹配。但是我的上游 ssl 证书模式是上游服务器主机名 (slc01etc.us.oracle.com) 。 …