curl/docs/cmdline-opts/follow.md
Daniel Stenberg 13cbabf05f
curl: add --follow
Makes curl follow redirects an act on the response code and change a
custom method accordingly, contrary to --location.

Potential future command line to send QUERY and following a redirect
according to the status code:

    curl -d "request-body" -X QUERY --follow https://example.com

add test 794,796,797

Assisted-by: Daniel Böhmer <post@daniel-boehmer.de>

Closes #16543
2025-08-04 17:12:14 +02:00

715 B

c SPDX-License-Identifier Long Help Category Added Multi See-also Example
Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. curl follow Follow redirects per spec http 8.16.0 boolean
request
location
-X POST --follow $URL

--follow

Instructs curl to follow HTTP redirects and to do the custom request method set with --request when following redirects as the HTTP specification says.

The method string set with --request is used in subsequent requests for the status codes 307 or 308, but may be reset to GET for 301, 302 and 303.

This is subtly different than --location, as that option always set the custom method in all subsequent requests independent of response code.