I'm trying to allow container with django to manage access to media files served from another container with nginx. Because of that despite of nginx documentation, I've removed the internal
line from the location config:
server {
server_name nginx; //name of the container used for accessing from another containers
charset UTF-8;
client_max_body_size 32m;
listen 80;
location /protected/media/ {
// internal;
alias /data/djan,go/media/;
}
}
With this config I'm able to use /protected/media urls from django containers so I've succeeded at doing wget http://nginx/protected/media/images/bank_credentials/H0grsrvgsBo.jpg
from shell of container with django.
But django's code
response = HttpResponse()
del response['Content-Type']
response['X-Accel-Redirect'] = 'http://nginx/protected/media/' + path # I'm sure that this url matches to url I've used succesfully with wget
return response
returning 404 Here is the django's url:
path('media/<path:path>', media_access, name='media')
Where I'm wrong?