Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
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
490
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
バイブスあるコーディングで ~PHP~ 便利ツールをつくるプラクティス
uzulla
1
320
ソフトウェア設計とAI技術の活用
masuda220
PRO
26
7.3k
大規模FlutterプロジェクトのCI実行時間を約8割削減した話
teamlab
PRO
0
450
Streamlitで実現できるようになったこと、実現してくれたこと
ayumu_yamaguchi
2
270
decksh - a little language for decks
ajstarks
4
21k
GUI操作LLMの最新動向: UI-TARSと関連論文紹介
kfujikawa
0
500
#QiitaBash TDDで(自分の)開発がどう変わったか
ryosukedtomita
1
350
SwiftでMCPサーバーを作ろう!
giginet
PRO
2
220
Quality Gates in the Age of Agentic Coding
helmedeiros
PRO
1
120
QA x AIエコシステム段階構築作戦
osu
0
240
新しいモバイルアプリ勉強会(仮)について
uetyo
1
250
Android 15以上でPDFのテキスト検索を爆速開発!
tonionagauzzi
0
190
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
431
65k
Done Done
chrislema
185
16k
Facilitating Awesome Meetings
lara
54
6.5k
How to train your dragon (web standard)
notwaldorf
96
6.2k
Testing 201, or: Great Expectations
jmmastey
45
7.6k
The Cult of Friendly URLs
andyhume
79
6.5k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
21
1.4k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
110
19k
It's Worth the Effort
3n
185
28k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
6k
Scaling GitHub
holman
461
140k
Why Our Code Smells
bkeepers
PRO
337
57k
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]