<html theme="default-light" iconset="color"><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head><body style="color: rgb(0, 0, 0);" text="#000000">
<style>
.inlcode {
font-family: monospace;
}
.codeblock {
display: block;
margin-top: 1em;
margin-bottom: 1em;
margin-left: 40px;
margin-right: 40px;
white-space: pre;
unicode-bidi: embed;
font-family: monospace;
}
</style>I hope I can at least get help diagnosing this.<br>
<br>
I have an ASP.Net Core application in a Ubuntu headless VM (DigitalOcean
Droplet) using a page TLD (therefore I must use SSL) using Cloudflare.
When I execute it using:
<br>
<div class="codeblock">dotnet domain.page.dll --launch-profile https</div>
Then use:<br>
<br>
<div class="inlcode" style="margin-left: 40px;">curl -k
<a class="moz-txt-link-freetext" href="https://127.0.0.1:5443">https://127.0.0.1:5443</a></div>
<br>
(the address that Kestrel is listening to) I get a page that I am
expecting. Therefore Kestrel and the application seem to be working.
Cloudflare is managing the domain name and I have a Cloudflare
certificate in the appsettings.json file. I hope that since Kestrel is
working it has accepted the certificate.<br>
<br>
When I browse to the domain from another system (over the
internet) Cloudflare is saying 502 Bad Gateway and that the
problem is in the server. Is there a log somewhere showing the incoming
request and more details
of the error?<br>
<br>
The following is my server block.<br>
<br>
<div class="inlcode" style="margin-left: 40px;"><pre>server {
listen 443 ssl;
listen [::]:443 ssl;
#ssl_client_certificate /etc/ssl/cloudflare.crt;
ssl_certificate /etc/ssl/domain.crt;
ssl_certificate_key /etc/ssl/domain.pem;
server_name domain.page *.domain.page;
location / {
proxy_pass <a class="moz-txt-link-freetext" href="http://127.0.0.1:5443">http://127.0.0.1:5443</a>;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}</pre></div>
<br>
I get the same results if I uncomment the ssl_client_certificate.<br>
<br>
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.<br>
</body></html>