502 Bad Gateway using Cloudflare and Kestrel

Francis Daly francis at daoine.org
Mon Sep 4 08:05:05 UTC 2023

On Sun, Sep 03, 2023 at 09:57:54PM -0700, Sam Hobbs wrote:

Hi there,

> curl -k
> (the address that Kestrel is listening to) I get a page that I am expecting.

>                 proxy_passhttp://;

You probably have a space after proxy_pass in your actual config; but
you probably should also have "https://" not "http://" there as well,
since your upstream service is listening for https connections.

> Is there a way to determine with relative certainty that the 502 is caused
> by something in nginx and not Cloudflare or Kestrel or the application? Is
> there a way to get more details? If someone knows how to fix the problem
> regardless of where and why it is happening then that would be great help.

The nginx error log should show its description of what it thinks is
happening; you can change the logging level to have more details written,
if that will help diagnose things.

And the port-5443 service should log something like "I got a http request
to a https port" wherever it writes its information.


Francis Daly        francis at daoine.org

More information about the nginx mailing list