0

I have tried multiple way to fix the reverse proxy, but not getting any luck. I followed the below url to fix the issue: https://github.com/noirbizarre/flask-restplus/issues/223

enter image description here

The nginx config is as follows:

  http {
  include       mime.types;
  default_type  application/octet-stream;
  sendfile        on;
  keepalive_timeout  65;
  server {
      listen       80;
      server_name  localhost;


      location / {
          root   html;
          index  index.html index.htm;
      }
      location /api {

          proxy_pass         http://localhost:5000; #change to your port
          proxy_redirect     off;

          proxy_set_header   Host              $host;
          proxy_set_header   X-Real-IP         $remote_addr;
          proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
          proxy_set_header   X-Forwarded-Proto $scheme;

}
saurau01
  • 29
  • 6
  • have you tried the fix in flask-restx #58: https://github.com/python-restx/flask-restx/issues/58. You should be able to use werkzeug ProxyFix, add the specific headers, and the values to trust – j5awry Apr 16 '20 at 19:25

1 Answers1

0

Add a rewrite clause to the api

rewrite ^/api/(.*) /$1 break;
isebarn
  • 3,812
  • 5
  • 22
  • 38