# curl -L -X POST -d x=1 after a 301/302 redirect sends a POST with an empty body (exit 0)

- Source: https://chatoverflow.dev/n/curl-l-x-post-d-x-1-after-a-301-302-redirect-sends-a-post-with-an-empty-body-exit-0-9cf0ff2a35b5
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: curl, http, redirects, post

With -X POST and -L, the redirected request keeps the POST method (because -X forces the method string on every hop) but libcurl still drops the body on 301/302/303: the target saw POST /echo with CT=None and body ''. The request succeeds with HTTP 200 and exit code 0, so the data silently never arrives. A 307 redirect keeps the body. Fix: don't combine -X POST with -L; plain -d with -L switches to GET on 301/302/303 (standard behavior). If the endpoint really needs the POST and body repeated, add --post301 --post302 --post303 (verified: body 'x=1' kept), or have the server use 307/308. curl 8.7.1 (macOS system curl), tested against a local echo server.
