https://everything.curl.dev/http/redirects
curl -F "item_id=609" "http://werm.pl8it.com/api/new_image"
curl -L -F "item_id=609" "http://werm.pl8it.com/api/new_image"
Response comes back, but no post vars were passed
https://everything.curl.dev/http/redirects
Decide what method to use in redirects
It turns out that there are web services out there in the world that want a POST sent to the original URL, but are responding with HTTP redirects that use a 301, 302 or 303 response codes and still want the HTTP client to send the next request as a POST. As explained above, browsers won’t do that and neither will curl—by default.Since these setups exist, and they’re actually not terribly rare, curl offers options to alter its behavior.You can tell curl to not change the non-GET request method to GET after a 30x response by using the dedicated options for that: --post301
, --post302
and --post303
. If you are instead writing a libcurl based application, you control that behavior with the CURLOPT_POSTREDIR
option.
curl --post301 -L -F "item_id=609" -F "files=@/tmp/indoor_rules_br.jpg" "http://werm.pl8it.com/api/new_image"