Answer the question
In order to leave comments, you need to log in
How to implement the return of different files to HTTP requests at the same URL?
Good day!
I have a task - to send different files from the server using NGINX to HTTP requests whose headers contain different data (in our case it will be a custom header with a number as a value that will also be stored in the database).
The question is:
Is it possible to implement a similar design using only NGINX?
Thank you in advance for your response.
Answer the question
In order to leave comments, you need to log in
For the "X-User-File" header, something like:
http {
# ...
map $http_x_user_file $kinofile {
default 'error.txt';
kino1 movie1.mp4;
kino2 old/TheMatrix.avi;
}
server {
# ...
location /film {
try_files /movies/$kinofile =404;
map
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question