x-accel-redirect enables caching for POST requests

Maxim Dounin mdounin at mdounin.ru
Wed Dec 23 15:49:02 UTC 2015


Hello!

On Wed, Dec 23, 2015 at 03:54:31PM +0300, Руслан Закиров wrote:

> Hi,
> 
> If location /a/ redirects a POST request to location /b/ using
> X-Accel-Redirect then result of the POST request is cached.
> 
> Tested this and reproduced with nginx 1.6.3 and 1.9.7.
> 
> Setup:
> https://gist.github.com/ruz/4a66ee78fedf27181799
> 
> Logs from hitting /a/:
> [1450873503.675] 200 HIT 127.0.0.1 "POST /a/ HTTP/1.1" [0.001, 0.001] {
> 127.0.0.1:5000}
> [1450873504.113] 200 HIT 127.0.0.1 "POST /a/ HTTP/1.1" [0.001, 0.001] {
> 127.0.0.1:5000}
> [1450873504.529] 200 HIT 127.0.0.1 "POST /a/ HTTP/1.1" [0.002, 0.002] {
> 127.0.0.1:5000}
> [1450873567.648] 200 EXPIRED 127.0.0.1 "POST /a/ HTTP/1.1" [0.001 : 0.002,
> 0.003] {127.0.0.1:5000 : 127.0.0.1:5000}
> 
> Logs from hitting /b/ directly:
> [1450875056.289] 200 - 127.0.0.1 "POST /b/ HTTP/1.1" [0.005, 0.005] {
> 127.0.0.1:5000}
> [1450875058.073] 200 - 127.0.0.1 "POST /b/ HTTP/1.1" [0.001, 0.001] {
> 127.0.0.1:5000}
> 
> Looks like a bug to me. Do I miss something?

X-Accel-Redirect changes a request from POST to GET.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list