Progress doesn't work if X-Progress-ID is set with more headers module
lexer opened this issue · comments
In our application we need X-Progress-ID to be parsed from $request_url
location /upload {
if ($request_uri ~* ^/upload/(.*)$) {
set $progress_id $1;
more_set_headers "X-Progress-ID:$progress_id";
}
proxy_pass http://127.0.0.1;
proxy_redirect default;
track_uploads proxied 30s;
}
However progress doesn't work in this case.
Can you attach (or send me privately by e-mail) the full debug log (you'll need to compile nginx with --with-debug)?
I think "more_set_headers" phase happens after the upload is registered in the upload progress module, which I'm afraid can't be fixed easily, but I'd like to check first with the log.
I've mailed it to you.
I also checked debug log and as you suggest get_tracking_id is called earlier then headers are set.
How can I fix it?
I also checked debug log and as you suggest get_tracking_id is called earlier then headers are set.
How can I fix it?
Hmm, reading more headers documentation, it looks like "more_set_headers" sets output headers (the one that will be returned to the client).
Can you try with "more_set_input_header" instead?
Yep, that solve half of problem. But first call get_tracking_id is performed earlier then setting of headers.
In our application we need to proxy traffic to Amazon that reject requests with querystring.
So currently we have solve problem in following way. We receive querystring param. Set header using querystring value and then remove querystring with rewriting.
location /upload {
if ($request_uri ~* "^/upload\?X-Progress-ID=(.*)$") {
set $progress_id $1;
more_set_input_headers "X-Progress-ID: $progress_id";
}
set $args "";
rewrite ^(.*)$ / break;
proxy_pass http://myamazonbucket.s3.amazonaws.com/;
#proxy_redirect default;
track_uploads proxied 30s;
}
Do you mean the problem is solved by the rewrite break?
Rewrite required to remove "/upload". set $args "" removes "X-Progress-ID" from querystring.