Reputation: 53
On my localhost I've got Docker with 2 containers: Nginx and Golang. I want to do request from my local machine and get response from Go (localhost -> Nginx -> Go).
Containers work. I can go into Nginx container and run
curl -v 'test:8080/path' -d "param1=value1¶m2=value2"
and I've got correct response.
But If I try to run the same request from host machine I've got an error - 502 Bad Gateway. If I change request and run curl -v -X POST 'test:8080/path'
(same request without data) - It's ok.
My Nginx config:
server {
listen 80;
server_name test;
client_max_body_size 20M;
charset utf8;
location / {
proxy_pass http://go:8000; // there go - docker compose link
}
}
I think, problem in Nginx configuration. But I'm newbie with nginx. Plz, help me :)
Upvotes: 0
Views: 1089
Reputation: 53
My fault, guys. My Go program returns nothing. So nginx
interpreted empty
response as bad request and return 502.
Upvotes: 1