受欢迎的博客标签

How to POST request turns into GET request in nginx with Asp .Net core (WeiXinThirdServer)

Published

1. http redirect https

 

 

2.   # proxy_set_header Connection "Upgrade"; error

 

\src\Presentation\WeiXinThirdServer\appsettings.json

{
  "Logging": {
    "LogLevel": {
      "Default": "Trace",
      "Microsoft": "Trace",
      "Microsoft.Hosting.Lifetime": "Trace"
    }
  },
  "AllowedHosts": "*"
}

 

  Request finished HTTP/1.1 GET http://www.iaspnetcore.com/weixin?originalid=gh_5588defc6e31&signature=f96ae1a6f1abae66f48f99eb393a7403b4621eb7&echostr=4512657114214096755&timestamp=1623333489&nonce=212610167 - - - 200 19 text/plain;+charset=utf-8 1.4586ms
dbug: Microsoft.AspNetCore.Server.Kestrel[0]
      Config reload token fired. Checking for changes...
dbug: Microsoft.AspNetCore.Server.Kestrel[0]
      Config reload token fired. Checking for changes...
dbug: Microsoft.AspNetCore.Server.Kestrel[0]
      Config reload token fired. Checking for changes...
dbug: Microsoft.AspNetCore.Server.Kestrel[39]
      Connection id "0HM9B9GUJLK8G" accepted.
dbug: Microsoft.AspNetCore.Server.Kestrel[1]
      Connection id "0HM9B9GUJLK8G" started.
dbug: Microsoft.AspNetCore.Server.Kestrel[17]
      Connection id "0HM9B9GUJLK8G" bad request data: "Requests with 'Connection: Upgrade' cannot have content in the request body."
      Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Requests with 'Connection: Upgrade' cannot have content in the request body.
         at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelBadHttpRequestException.Throw(RequestRejectionReason reason)

 

/etc/nginx/sites-enabled/default

    proxy_http_version 1.1;
                                        proxy_set_header Upgrade $http_upgrade;
                                       # proxy_set_header Connection "Upgrade";   # del here