Support Forums

Proxy POST requests via netlify.toml redirects

I’ve successfully deployed my site https://ejecafetero.fincaraiz.com.co/ redirects following the redirects debugging guide as well as the Docs

GET requests are proxied successfully but any POST request is sent as a GET

x-nf-request-id: 869d6e8b-3cb9-4930-b028-cc271a345aba-22410895

from = "/api/*"
to = "https://api-fairs-dev.frcol.io/api/:splat"
status = 200
force = true
headers = { X-From = "Netlify", X-Forwarded-Host = "ejecafetero.fincaraiz.com.co" }

is there anything I need to do to support POST requests?

Hi @raczosala

Welcome to the Netlify community.

Your redirects syntax is fine. I have tested a similar thing both same-site and cross-site and have no issues with POST.

Where are you calling the /api/ URL? Is it part of a script?

Hi @coelmay the request is made from a nextjs project, it’s a simple POST

export async function schedule(params: ScheduleRequest) {
  return fetch(`${baseUrl}/leads/create`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    body: JSON.stringify(params),

my POST request URL was missing the trailing /

1 Like