1

I am serving restricted downloads in nodejs using X-Accel-Redirect with nginx. I am trying to send the custom header in the non standard HTTP header Header1,Header2 to the X-Accel-Redirect request. But this is not working.

below the rails snippet used to do the redirection

  var  httpHeaders={'NonStandardHeader':"Hello"}
  var headers = Object.assign({ 'X-Accel-Redirect': url }, httpHeaders);
     res.writeHead(200, headers);
    res.end();

nginx.conf

 location /microservice/file {
   alias /protected;
  internal;
}
 location /microservice/memcache {
  ... 
  internal;
}

1 Answer 1

2

I found solution for the question.passing querystring to internal location


nodejs:

var    url='/microservice/file/a1.json?p=23x&e=22d';
   res.writeHead(200, { 'X-Accel-Redirect': url });
res.end();

nginx.conf

location /microservice/file {
   alias /protected;
    add_header 'NonStandardHeader' $arg_p;
      expires $arg_e;

  internal;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.