cli
cli copied to clipboard
Redirect converts POST request to a GET request without body
Describe the bug
Redirect converts POST request to a GET request without body
To Reproduce
Steps to reproduce the behavior:
- Create a POST function i.e.
/.netlify/functions/create-ticket - Redirect
/create-ticketto/.netlify/functions/create-ticketvia_redirectsornetlify.toml - POST
/create-ticketredirects to GET/.netlify/functions/create-ticketwithout body
Same happens in netlify dev (netlify-cli/3.39.0 darwin-x64 node-v12.7.0) and production deployments.
Configuration
- If possible, please copy/paste below your
netlify.toml:
[build]
functions = "functions"
[[redirects]]
from = "/create-ticket"
to = "/.netlify/functions/create-ticket"
- Please enter the following command in a terminal and copy/paste its output:
System:
OS: macOS 11.2.3
CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
Memory: 114.97 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 12.7.0 - ~/.nvm/versions/node/v12.7.0/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 7.0.10 - /usr/local/bin/npm
npmGlobalPackages:
netlify-cli: 3.39.0
Expected behavior
POST /create-ticket redirects to POST /.netlify/functions/create-ticket with body
CLI Output
While in netlify dev and requesting POST /create-ticket I receive this message in bash:
Request from ::1: GET /.netlify/functions/create-ticket
I'm encountering this bug too, has it been patched?
I'm encountering this bug too, has it been patched?
dunno, haven't touched that project since 2021 Jun
Try with temporary redirect status
[[redirects]]
from = "/create-ticket"
to = "/.netlify/functions/create-ticket"
status=307 // <-- temporary redirect
force = true