CURL.SetOptionPostRedir
-----------------------

Sets the redirect policy.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CURL](component_CURL.md) | [2.5](newinversion25.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "CURL.SetOptionPostRedir"; curl; Value ) 

**MBS**( **"CURL.SetOptionPostRedir";** /\* Sets the redirect policy. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$Value**) /\* The new bitmask for redirections.e.g. 3 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| curl | The CURL session handle. | $curl |
| Value | The new bitmask for redirections. | 3 |

### Result

Returns "OK" on success.

### Description

Sets the redirect policy.  
Pass a bitmask to control how libcurl acts on redirects after POSTs that get a 301 or 302 response back. A parameter with bit 0 set (value CURL\_REDIR\_POST\_301) tells the library to respect RFC 2616/10.3.2 and not convert POST requests into GET requests when following a 301 redirection. Setting bit 1 (value CURL\_REDIR\_POST\_302) makes libcurl maintain the request method after a 302 redirect. CURL\_REDIR\_POST\_ALL is a convenience define that sets both bits.  
  
The non-RFC behavior is ubiquitous in web browsers, so the library does the conversion by default to maintain consistency. However, a server may require a POST to remain a POST after such a redirection. This option is meaningful only when setting [CURL.SetOptionFollowLocation](CURLSetOptionFollowLocation.md). (This option was known as CURLOPT\_POST301 up to 7.19.0 as it only supported the 301 way before then)  
  
| CURL\_REDIR\_POST\_301 | 1 |
|---|--:|
| CURL\_REDIR\_POST\_302 | 2 |
| CURL\_REDIR\_POST\_ALL | 3 |

See also [POSTREDIR](https://curl.haxx.se/libcurl/c/CURLOPT_POSTREDIR.html) option in CURL manual.

### See also

- [CURL.GetOptionPostFields](CURLGetOptionPostFields.md)
- [CURL.GetOptionPostQuote](CURLGetOptionPostQuote.md)
- [CURL.SetOptionCookieJar](CURLSetOptionCookieJar.md)
- [CURL.SetOptionFollowLocation](CURLSetOptionFollowLocation.md)
- [CURL.SetOptionMaxRedirs](CURLSetOptionMaxRedirs.md)
- [CURL.SetOptionPost](CURLSetOptionPost.md)
- [CURL.SetOptionPostFields](CURLSetOptionPostFields.md)
- [CURL.SetOptionPostFieldSize](CURLSetOptionPostFieldSize.md)
- [CURL.SetOptionPostQuote](CURLSetOptionPostQuote.md)
- [CURL.SetOptionProxyHeader](CURLSetOptionProxyHeader.md)

### Blog Entries

- [Translating Insert from URL options for CURL to MBS Plugin calls](https://www.mbsplugins.de/archive/2020-12-14/Translating_Insert_from_URL_op/monkeybreadsoftware_blog_filemaker)

Created 18th August 2014 , last changed 3th February 2021

  
[CURL.SetOptionPostQuote](CURLSetOptionPostQuote.md) - [CURL.SetOptionPreProxy](CURLSetOptionPreProxy.md)

[HTML Version](CURLSetOptionPostRedir.shtml)