mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-12 01:55:39 +00:00
Files under /media require session to be authenticated
References: - https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/apache-auth/ - https://stackoverflow.com/questions/46421589/nginx-location-and-django-auth - https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-subrequest-authentication/ - https://pawamoy.github.io/posts/django-auth-server-for-shiny/
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
|
||||
server {
|
||||
|
||||
# Listen for connection on (internal) port 80
|
||||
@ -37,12 +38,20 @@ server {
|
||||
# Redirect any requests for media files
|
||||
location /media/ {
|
||||
alias /var/www/media/;
|
||||
autoindex on;
|
||||
|
||||
# Caching settings
|
||||
expires 30d;
|
||||
add_header Pragma public;
|
||||
add_header Cache-Control "public";
|
||||
# Media files require user authentication
|
||||
auth_request /auth;
|
||||
}
|
||||
|
||||
# Use the 'user' API endpoint for auth
|
||||
location /auth {
|
||||
internal;
|
||||
|
||||
proxy_pass http://inventree-server:8000/auth/;
|
||||
|
||||
proxy_pass_request_body off;
|
||||
proxy_set_header Content-Length "";
|
||||
proxy_set_header X-Original-URI $request_uri;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user