paurakhsharma/python-microservice-fastapi

Error:502 Bad Gateway nginx/1.19.4

Opened this issue · 1 comments

Thanks for the nice code.
While running the following error occurs, any idea how to fix it?
502 Bad Gateway nginx/1.19.4

add these lines in your nginx_config file
server {
listen 8080;
server_name localhost;
location /api/v1/movies {
proxy_pass http://movie_service:8000/api/v1/movies;
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;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
}

location /api/v1/casts {
proxy_pass http://cast_service:8000/api/v1/casts;
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;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
}

}