Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Protecting static files in your web app
Search
Max Ludwig
January 02, 2016
Programming
0
500
Protecting static files in your web app
... in production
https://github.com/dAnjou/xsendfile-example
Max Ludwig
January 02, 2016
Tweet
Share
Other Decks in Programming
See All in Programming
AIの弱点、やっぱりプログラミングは人間が(も)勉強しよう / YAPC AI and Programming
kishida
13
5.5k
分散DBって何者なんだ... Spannerから学ぶRDBとの違い
iwashi623
0
140
WebRTC と Rust と8K 60fps
tnoho
2
720
TypeScriptで設計する 堅牢さとUXを両立した非同期ワークフローの実現
moeka__c
5
2.7k
Stay Hacker 〜九州で生まれ、Perlに出会い、コミュニティで育つ〜
pyama86
2
2.9k
AI駆動開発ライフサイクル(AI-DLC)のホワイトペーパーを解説
swxhariu5
0
1.6k
これだけで丸わかり!LangChain v1.0 アップデートまとめ
os1ma
4
340
CSC305 Lecture 15
javiergs
PRO
0
210
Honoを技術選定したAI要件定義プラットフォームAcsimでの意思決定
codenote
0
280
CSC305 Lecture 17
javiergs
PRO
0
200
高単価案件で働くための心構え
nullnull
0
170
アーキテクチャと考える迷子にならない開発者テスト
irof
9
3.4k
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.1k
The Pragmatic Product Professional
lauravandoore
36
7k
Building an army of robots
kneath
306
46k
Done Done
chrislema
186
16k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
14k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
11
950
RailsConf 2023
tenderlove
30
1.3k
Facilitating Awesome Meetings
lara
57
6.6k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
34
2.3k
Statistics for Hackers
jakevdp
799
230k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Transcript
… in production Protecting static files in your web app
X-Sendfile HTTP header
GET /video.ogv video.ogv web server web app check permissions +
set header check header + serve file
from django.http import HttpResponse from django.utils.encoding import smart_str def sendfile(request,
filename, **kwargs): # check requesting user’s permissions response = HttpResponse() response['X-Sendfile'] = smart_str(unicode(filename)) return response django-sendfile/sendfile/backends/xsendfile.py
<VirtualHost *:80> XSendFile On # ... </VirtualHost> /etc/apache2/sites-available/example.de
Apache2: X-Sendfile nginx: X-Accel-Redirect Lighttpd: X-LIGHTTPD-send-file
github.com/dAnjou/xsendfile-example
[email protected]