Skip to content

502 Bad Gateway when running behind Nginx reverse proxy #772

@MarianeDomi1

Description

@MarianeDomi1

Hi team,

I am trying to run the mcp-server in a Docker container behind an Nginx reverse proxy with a Let's Encrypt SSL certificate.

My setup is working correctly (Docker container is 'Up', Nginx is running, firewall is open), but I am getting a 502 Bad Gateway error. The Nginx error log shows "upstream prematurely closed connection". The curl -v output also confirms a 502 error after a successful connection.

It seems the mcp-server application closes the connection when it receives a standard HTTP request from the Nginx proxy.

Could you please advise on the correct Nginx configuration for reverse proxying? Is this setup supported?

Here is my Nginx config:

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions