标签: reverse-proxy

Azure Web 应用服务:IIS 反向代理可能吗?

是否可以在 IIS 上为 Azure 应用服务运行反向代理?

我想将 https 的代理 socket.io 端口 3000 反向到端口 443。

iis reverse-proxy azure socket.io

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

Nginx 遵循重定向和反向代理最后位置

我正在尝试反向代理一个内部有 N 重定向 301 的 URL。
\n我想跟踪所有页面,然后反向代理最后一个页面(fourth-url.php)。

\n\n

Nginx 有双重功能吗?

\n\n

这是场景

\n\n

第一个网址:

\n\n

http://first-domain.com/first-url.php

\n\n

重定向至

\n\n

http://first-domain.com/second-url.php

\n\n

重定向至

\n\n

http://first-domain.com/third-url.php

\n\n

重定向至(最后一个)

\n\n

http://first-domain.com/fourth-url.php

\n\n

这是我到目前为止所做的文件配置:

\n\n
server {\n\n  set $base_url \'http://first-domain.com\';\n  set $page \'first-url.php\'\n\n  location /myserver {\n     resolver 8.8.8.8;\n     proxy_set_header X-Real-IP  $remote_addr;\n     proxy_set_header X-Forwarded-For $remote_addr;\n     proxy_set_header Host $host;\n     proxy_pass $base_url/$page;\n     proxy_intercept_errors on;\n     error_page 301 302 307 = @handle_redirect;\n  }\n\n  location @handle_redirect {\n     resolver 8.8.8.8;\n     set $saved_redirect_location $upstream_http_location;\n     proxy_set_header X-Real-IP  $remote_addr;\n     proxy_set_header X-Forwarded-For $remote_addr;\n     proxy_set_header Host …
Run Code Online (Sandbox Code Playgroud)

redirect reverse-proxy nginx

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

配置Nginx根据端口号将代理请求反向到后端服务器

我有四个 Web 应用程序在一个 ec2 实例中运行,主机名为“ip-10-176-225-83.us-west-2.compute.internal”,端口为 8888、8088、8042 和 8890。所有这些 Web 应用程序都在 HTTP 上。

我们的安全团队不允许打开从本地到 AWS 的 http 端口。建议在同一 VPC 子目录中设置反向代理,该代理接受 HTTPS 请求并使用 HTTP 将其转发到后端 Web 服务器。

我在同一子网中创建了一个主机名为“ip-10-176-225-84.us-west-2.compute.internal”的新实例并安装了 Niginx 服务器。

我如何配置 Nginx 使其执行以下操作

https://ip-10-176-225-84.us-west-2.compute.internal:8080 调用http://ip-10-176-225-83.us-west-2.compute.internal: 8080并回复

其他端口也一样

reverse-proxy nginx

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

如何在 Go ReverseProxy 中使用 TLS?

我有站点https://a-b-c.com并分别在端口和https://www.x-y-z.com上的反向代理后面运行。44445555

我将它们配置为使用 LetsEncrypt TLS 证书,但现在使用反向代理时出现错误,我认为我需要使用&tls.config{}包含其证书的证书,但我不知道如何设置它。

我的反向代理看起来像:

  director := func(req *http.Request) {                        
    log.Println(req.Host)                                      
    switch req.Host {                                          
    case "a-b-c-.com":                                 
      req.URL.Host = "localhost:4444"                        
      req.URL.Scheme = "https"                                 
    case "x-y-z.com":                                   
      req.URL.Host = "localhost:5555"                           
      req.URL.Scheme = "https"                                                                                   
  }                                                            
  proxy := &httputil.ReverseProxy{Director: director}          
  proxy.Transport = &http.Transport{                           
    Proxy: http.ProxyFromEnvironment,                          
    Dial: (&net.Dialer{                                        
      Timeout:   30 * time.Second,                             
      KeepAlive: 30 * time.Second,                             
    }).Dial,                                                   
    TLSHandshakeTimeout: 10 * time.Second,                     
    TLSClientConfig:     &tls.Config{InsecureSkipVerify: true},
  }                                                            

  log.Fatalln(http.ListenAndServe(":443", proxy))              
Run Code Online (Sandbox Code Playgroud)

ssl reverse-proxy go

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

nginx 从rails 反向代理到wordpress

我有一个 Ruby on Rails 应用程序和一个托管在不同 EC2 实例上的 Wordpress 博客。

我正在尝试使 Wordpress 博客充当 Rails 应用程序的子文件夹(example.com/blog 而不是 blog.example.com),以实现更好的 SEO

  • Rails应用程序可以通过http和https访问(http正在重定向到https)

https://www.nginx.com/resources/admin-guide/reverse-proxy/

我尝试使用 nginx 反向代理功能,我认为这是我现在最好的选择,但我的尝试不成功。

  1. 博客的主页按预期打开(example.com/blog),但没有 CSS。
  2. 带有争论的 URL (example.com/blog/args) 将我重定向回 Rails 应用程序 (example.com/args)

我在 wp-config.php 中设置所需的博客 URL,如下所示:

define('WP_SITEURL', 'https://www.example.com/blog');
define('WP_HOME', 'https://www.example.com/blog');
Run Code Online (Sandbox Code Playgroud)

这是我使用的 nginx 配置:

  location ^~ /blog {
   proxy_pass http://<<BLOGIP>>/blog;
   proxy_set_header X-Real-IP $remote_addr;
   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
Run Code Online (Sandbox Code Playgroud)

对于 Rails 应用程序和 Wordpress 博客来说,出于自动扩展、冗余和部署目的保持分离非常重要。

如果有其他方法可以实现这一目标,我愿意接受建议。

url wordpress reverse-proxy ruby-on-rails nginx

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

HAProxy + Keycloak 重定向问题

我有一个 HAProxy 在两台以独立模式运行 Keycloak 的机器前面充当负载均衡器。

版本

  • HAProxy 版本 1.6.3,2015/12/25 发布
  • Keycloak版本2.4.0.Final

HAProxy 配置

global
  user haproxy
  group haproxy
  log /dev/log local0
  log-tag WARDEN
  chroot /var/lib/haproxy
  daemon
  quiet
  stats socket /var/lib/haproxy/stats level admin
  maxconn 256
  pidfile /var/run/haproxy.pid
  tune.bufsize 262144

defaults
  timeout connect 5000ms
  timeout client 5000ms
  timeout server 5000ms
  log global
  mode http
  option httplog
  option dontlognull
  option redispatch
  retries 5
  stats uri /haproxy-status

frontend http-in
  mode http
  bind *:80
  maxconn 2000
  redirect scheme https code 301 if !{ ssl_fc } …
Run Code Online (Sandbox Code Playgroud)

reverse-proxy load-balancing haproxy keycloak

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

由于启用了严格的 MIME 类型检查,拒绝执行脚本

我通过另一个域名 (www.bbb.com) 设置了一个 NGINX 反向代理到 Web 服务 (www.aaa.com),同时向后者添加了一些附加页面。

请求来自www.bbb.com(nodejs 应用程序),但它们需要看起来像是来自,www.aaa.com否则我将遇到 CORS(跨源资源共享)问题。因此 NGINX 需要调整 headers。

NGINX 配置

worker_processes 1;
events {
    worker_connections 1024;
}
http {
    include mime.types;
    include servers/*;
    default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;

    server {
        listen 443 ssl;
        server_name www.bbb.com;
        ssl_certificate /etc/pki/nginx/server.crt;
        ssl_certificate_key /etc/pki/nginx/private/server.key;
        ssl_session_cache shared:SSL:1m;
        ssl_session_timeout 5m;
        ssl_ciphers HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers on;

        location / {
            proxy_set_header X-Real-IP 127.0.0.1;
            proxy_set_header Host www.aaa.com;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_pass https://www.aaa.com;
            proxy_http_version 1.1;
        }
    }
} …
Run Code Online (Sandbox Code Playgroud)

reverse-proxy nginx mime-types

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

traefik 中的 nginx `proxy_redirect` (重定向而不更改 url)

如果可能的话,基本上这在 traefik 中会是什么样子:

location  /blog/ {
    proxy_pass https://blog.example.com/;
    proxy_redirect https://blog.example.com/ https://www.example.com/blog/;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host blog.example.com;
} 
Run Code Online (Sandbox Code Playgroud)

我尝试过,在我的 docker-compose 中配置:

- 'traefik.frontend.redirect.regex=^https://example.com/blog/(.*)$$'
- 'traefik.frontend.redirect.replacement=https://blog.example.com/$$1'
Run Code Online (Sandbox Code Playgroud)

这确实有效,但它只是重定向到https://blog.example.com,我想保留原始网址https://example.com/blog/并显示来自 的内容https://blog.example.com

用traefik可以实现吗?

redirect reverse-proxy traefik nginx-reverse-proxy traefik-middleware

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

在 docker 容器中将 pgadmin 与 nginx 结合使用

我遇到了配置环境的问题,包括 postgres、pgadmin 和 nginx。所有这些服务都位于 docker 容器中,这是我的 docker-compose 文件:

version: '3'

services:
  postgres:
    image: postgres
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres

  pgadmin:
    links:
      - postgres:postgres
    image: dpage/pgadmin4:3.0
    environment:
      PGADMIN_DEFAULT_EMAIL: 'postgres@pg.com'
      PGADMIN_DEFAULT_PASSWORD: 'postgres'
    ports:
      - "5050:80"
    restart: unless-stopped

  nginx:
    links:
      - pgadmin:pgadmin
    image: "nginx:1.13.12"
    ports:
      - "80:80"
    volumes:
      - ./nginxServers/server:/etc/nginx/conf.d/default.conf
Run Code Online (Sandbox Code Playgroud)

这是我的nginx.conf,放置在./nginxServers/server

server {
    listen       80;
    server_name  _;

    location  /pgadmin/ {                                                                    
            proxy_pass http://pgadmin/;
    }
}
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,这是一个非常简单的设置,允许我通过http://localhost/pgadmin使用 pgadmin 。

不幸的是,这不起作用。我可以通过http://127.0.0.1:5050看到 pgadmin Web 界面,但是当我导航到http://127.0.0.1/pgadmin时,所有样式和脚本都没有加载。

我还尝试了 nginx 配置中的另一个位置: …

django reverse-proxy nginx pgadmin docker

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

根据用户名转发 SSH 连接

我发现很多网站解释ssh 端口转发ssh 反向代理ssh 多路复用sshpiper等,涉及sslh运行 ssh 袜子服务器配置本地 SSH 服务器等等。所以我现在很困惑,可能会问一个非常常见和/或简单的问题:

正如您可能已经从标题中猜到的那样,我想在 docker 容器内设置一个 git 服务器 (GitLab),监听端口 22 上的 SSH 连接,而不必使用不同的端口进行默认 ssh 操作(终端、scp 等......)在主机上(按照此处的建议)

IE

  • ssh alice@myserver.org应该仍然是可能的以及
  • git clone git@myserver.com:path/to/project
  • 我不想在客户端计算机上进行任何设置

如果您喜欢图片:

                                      +------ myserver.org --------+
                                      |  +----+     +- typical -+  |
+--------+   alice@myserver.org:22    |  |    |     |   SSH     |  |
| client |  ---------------------->  -+--+----+---->|  service  |  |
+--------+     all names but `git`    |  | …
Run Code Online (Sandbox Code Playgroud)

ssh port proxy reverse-proxy docker

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