Update nginx proxy of media files
This commit is contained in:
parent
55021db557
commit
4a1bd56fd9
3 changed files with 4 additions and 4 deletions
|
@ -13,7 +13,7 @@ server {
|
|||
alias /srv/nummi;
|
||||
}
|
||||
|
||||
location /media {
|
||||
location /internal/media {
|
||||
internal;
|
||||
alias /var/lib/nummi;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ from django.conf.urls.static import static
|
|||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path("media/", views.media, name="media"),
|
||||
path("media/<path>", views.media, name="media"),
|
||||
] + i18n_patterns(
|
||||
path("", include("main.urls")),
|
||||
path("plot/", include("plot.urls")),
|
||||
|
|
|
@ -2,8 +2,8 @@ from django.http import HttpResponse
|
|||
from django.contrib.auth.decorators import login_required
|
||||
|
||||
@login_required
|
||||
def media(request):
|
||||
def media(request, path):
|
||||
_res = HttpResponse()
|
||||
_res["Content-Type"] = ""
|
||||
_res["X-Accel-Redirect"] = request.path
|
||||
_res["X-Accel-Redirect"] = "/internal/media/" + path
|
||||
return _res
|
||||
|
|
Loading…
Reference in a new issue