0

I have a very simple Nginx server that forwards traffic from subdomain to my http server on port 8000 like so :

server {
    listen       80;
    server_name *.localhost;

    location / {
        proxy_pass http://localhost:8000;
        proxy_set_header Host            $host;
        proxy_set_header X-Forwarded-For $remote_addr;
    }
}

My http server then takes care of everything by reading the hostame etc and it's working fine for any basic api/json requests.

Now i'm trying to send a file to my server but get a 403 error from nginx on sending the file / multipart form data.

From reading the doc i'm a bit confused as " upload_pass_args " seems to require a dedicated route configured in the conf file and that's not something i want at all. I just need the multipart / form data passed to my server's router to be handled ( the http server on :8000 )

I've also try to include sendfile on; in both my server{} or inside location{} but to no success.

jayD
  • 101
  • 1
  • 2
  • i think proxy_request_buffering off; might have just helped – jayD Jun 18 '20 at 10:14
  • Why complicate things by putting one reverse proxy in front of another? – Gerard H. Pille Jun 18 '20 at 11:43
  • i'm no where near a pro at this. I'm just trying to redirect localhost:9000 to one domain and all the subdomains to another server thats why i'm using the reverse proxy. do you mean i should write it as 2 separate server{} and not proxy{} ? – jayD Jun 18 '20 at 12:31
  • No, I meant not using Nginx at all, but the webserver you've currently got running on localhost:8000. Have it listening on port 80 too, and problem solved. – Gerard H. Pille Jun 18 '20 at 14:52
  • ah yeah but there's 2 app on the same machine running on different local ports but both listening on 80 ( on serving domain.com and the one from the question running sudbomains.domain.com ) – jayD Jun 18 '20 at 15:23

1 Answers1

0

proxy_request_buffering off; will fix the issue.

From reading this answer i suspect a proper configuration of the buffer would be the way to go when i've tried/done that i'll try to update this answer.

jayD
  • 101
  • 1
  • 2