English 中文(简体)
NGIssel逆转代理和互换。
原标题:NGINX reverse proxy and swagger-ui.html

我一直在试图夸夸张地工作,支持国家地理信息小组的反面代理,但我不能这样做。 我的服务在码头集装箱中进行,我想用这些样本ur:

我的服务:

http://service-host.example.com/my-service1

www.un.org/Depts/DGACM/index_spanish.htm www.un.org/Depts/DGACM/index_spanish.htm Swagger:

http://service-host.example.com/my-service1/api

www.un.org/Depts/DGACM/index_spanish.htm

我的空洞区块就这样:

location /my-service1 {
  resolver 127.0.0.11 valid=30s;
  set $upstream my-host.example.com;
  proxy_pass http://$upstream/home;

      location ~ /api {
            resolver 127.0.0.11 valid=30s;
            set $upstream my-host.example.com;
            proxy_pass http://$upstream/swagger-ui.html;
      }
      location ~ /webjars {
            resolver 127.0.0.11 valid=30s;
            set $upstream my-host.example.com;
            proxy_pass http://$upstream/;
      }
      location ~ /v2 {
            resolver 127.0.0.11 valid=30s;
            set $upstream my-host.example.com;
            proxy_pass http://$upstream/;
      }
      location ~ /swagger-resources {
            resolver 127.0.0.11 valid=30s;
            set $upstream my-host.example.com;
            proxy_pass http://$upstream/;
      }
}

我的NGI Singh记录就是这样的:

GET /my-service1/api/ HTTP/2.0" 200
GET /my-service1/api/webjars/springfox-swagger-ui/springfox.css?v=2.9.2 HTTP/2.0" 200
GET /my-service1/api/webjars/springfox-swagger-ui/swagger-ui-bundle.js?v=2.9.2 HTTP/2.0" 200
GET /my-service1/api/webjars/springfox-swagger-ui/swagger-ui.css?v=2.9.2 HTTP/2.0" 200
GET /my-service1/api/webjars/springfox-swagger-ui/springfox.js?v=2.9.2 HTTP/2.0" 200
GET /my-service1/api/webjars/springfox-swagger-ui/swagger-ui-standalone-preset.js?v=2.9.2 HTTP/2.0" 200

如果不通过国家地理信息小组进行直接测试,这一过程就会进一步推进,而全球教育论坛则会投入到/v2/api和/swagger-resources。 在此之前,使用反面代理就 st了。

关于如何解决这一问题的任何建议?

EDIT:在不试图推翻代理的情况下,这里是一个NGI 陈词,但直接投到http://myservice.example.com/swagger-ui.html。 它完美地发挥作用!

myservice.example.com 192.168.1.30 - - [12/Feb/2019:09:59:44 +0000] "GET /swagger-ui.html HTTP/2.0" 200 3318 "-" "Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0"
myservice.example.com 192.168.1.30 - - [12/Feb/2019:09:59:44 +0000] "GET /webjars/springfox-swagger-ui/springfox.css?v=2.9.2 HTTP/2.0" 200 2894 "https://myservice.example.com/swagger-ui.html" "Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0"
myservice.example.com 192.168.1.30 - - [12/Feb/2019:09:59:44 +0000] "GET /webjars/springfox-swagger-ui/swagger-ui.css?v=2.9.2 HTTP/2.0" 200 154488 "https://myservice.example.com/swagger-ui.html" "Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0"
myservice.example.com 192.168.1.30 - - [12/Feb/2019:09:59:45 +0000] "GET /webjars/springfox-swagger-ui/swagger-ui-bundle.js?v=2.9.2 HTTP/2.0" 200 1448844 "https://myservice.example.com/swagger-ui.html" "Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0"
myservice.example.com 192.168.1.30 - - [12/Feb/2019:09:59:45 +0000] "GET /webjars/springfox-swagger-ui/springfox.js?v=2.9.2 HTTP/2.0" 200 96207 "https://myservice.example.com/swagger-ui.html" "Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0"
myservice.example.com 192.168.1.30 - - [12/Feb/2019:09:59:45 +0000] "GET /webjars/springfox-swagger-ui/swagger-ui-standalone-preset.js?v=2.9.2 HTTP/2.0" 200 440850 "https://myservice.example.com/swagger-ui.html" "Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0"
myservice.example.com 192.168.1.30 - - [12/Feb/2019:09:59:46 +0000] "GET /swagger-resources/configuration/ui HTTP/2.0" 200 450 "https://myservice.example.com/swagger-ui.html" "Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0"
myservice.example.com 192.168.1.30 - - [12/Feb/2019:09:59:46 +0000] "GET /swagger-resources/configuration/security HTTP/2.0" 200 2 "https://myservice.example.com/swagger-ui.html" "Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0"
myservice.example.com 192.168.1.30 - - [12/Feb/2019:09:59:46 +0000] "GET /swagger-resources HTTP/2.0" 200 90 "https://myservice.example.com/swagger-ui.html" "Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0"
myservice.example.com 192.168.1.30 - - [12/Feb/2019:09:59:46 +0000] "GET /v2/api-docs HTTP/2.0" 200 8387 "https://myservice.example.com/swagger-ui.html" "Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0"
问题回答

swagger working in my server (NET CORE) with this conf

    location / {
        #root   /srv/ftp;
        #index  index.html index.htm;
        proxy_pass         http://localhost:5000;
        proxy_http_version 1.1;
        proxy_set_header   Upgrade $http_upgrade;
        proxy_set_header   Connection keep-alive;
        proxy_set_header   Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
    }




相关问题
Forwarding HTTP Request with Direct Server Return

I have servers spread across several data centers, each storing different files. I want users to be able to access the files on all servers through a single domain and have the individual servers ...

Rails page caching vs. HTTP reverse proxy caches

I ve been catching up with the Scaling Rails screencasts. In episode 11 which covers advanced HTTP caching (using reverse proxy caches such as Varnish and Squid etc.), they recommend only considering ...

ASP.Net reverse proxy, what to do with external resources?

I m currently working on a concept for a reverse proxy to basically relay responses and requests between the user and an otherwise invisible website. So basically the user goes to a site, let s say ...

Tomcat serving URLs wrong with mod_proxy and apache

I ve set up a host with apache to serve static pages and to use Tomcat to serve my web application (See this question). The static pages are server from "http://myhost.com" and the dynamic (tomcat) ...

Perlbal Reproxy with Remote Host

why would perlbal s reproxying give me a 503 for any remote url? X-REPROXY-URL: /path/to/a/local/file.jpg = working X-REPROXy-URL: http://a-public-file-in-an-s3-bucket.jpg = HTTP 503 my perlbal conf ...

Socket Proxy Server

Suppose Client A connects though TCP/IP Sockets to Server B Is it possible to create a Proxy Like Server thing to do this: Client A Connects to Proxy X ; And tried to authenticate to the server (...

热门标签