Home > Blockchain >  Why does "Host" header changing POST to GET request?
Why does "Host" header changing POST to GET request?

Time:12-30

I've searched many articles, but none of them answered my question

I have a code in NestJS:

this.http.post(url, {
  // some params
}, {
  // here must be headers
  Host: 'www.webhook.site'
}

When the 'Host' header is set, my POST request switches to GET somehow And webhook.site tells that it's getting GET request, not POST And when I am removing 'Host' header, it's okay and works as expected (I mean POST request becoming POST request)

CodePudding user response:

Requests to www.webhook.site receive a 301 redirect to webhook.site.

Clients following 301 redirects switch to GET requests.

  • Related