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
510
0
Share
Protecting static files in your web app
... in production
https://github.com/dAnjou/xsendfile-example
Max Ludwig
January 02, 2016
Other Decks in Programming
See All in Programming
[KCD Czech] eBPF Meets the GPU: Future of AI Infra Observability
doniacld
0
130
誰も頼んでない機能を出荷した話
zekutax
0
150
iOS26時代の新規アプリ開発
yuukiw00w
0
230
AIチームを指揮するOSS「TAKT」活用術 / How to Use “TAKT,” an OSS Tool for Orchestrating AI Teams
nrslib
6
760
Oxlintはいかにしてtsgolintのlint ruleを呼び出しているのか
syumai
2
1k
SPMマルチモジュールで テストカバレッジを取得する技法
yosshi4486
0
140
tsserverとは何だったのか、これからどうなるのか
nowaki28
1
430
Composerを使ったサプライチェーン攻撃の様子を眺めてみる #phpstudy
o0h
PRO
2
200
OSもどきOS
arkw
0
370
Technical Debt: Understanding it Rightly, Engaging it Rightly #LaravelLiveJP
shogogg
0
180
Lessons from Spec-Driven Development
simas
PRO
0
110
AIとRubyの静的型付け
ukin0k0
0
490
Featured
See All Featured
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
1.5k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
Done Done
chrislema
186
16k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
380
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.2k
Thoughts on Productivity
jonyablonski
76
5.2k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
710
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
300
Facilitating Awesome Meetings
lara
57
6.9k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.5k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
150
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]