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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
AlarmKitで明後日起きれるアラームアプリを作る
trickart
0
130
いつか誰かが、と思っていた フロントエンド刷新5年間の実践知
kiichisugihara
1
260
Import assertionsが消えた日~ECMAScriptの仕様はどう決まり、なぜ覆るのか~
bicstone
2
180
Back to the roots of date
jinroq
0
800
PicoRuby for IoT: Connecting to the Cloud with MQTT
yuuu
2
770
JCON - Create Agentic AI Apps, The Easy Way!
kdubois
1
100
Programming with a DJ Controller — not vibe coding
m_seki
3
820
Firefoxにコントリビューションして得られた学び
ken7253
2
160
Making the RBS Parser Faster
soutaro
0
690
実践ハーネスエンジニアリング:ステアリングループを実例から読み解く / Practical Harness Engineering: Understanding Steering Loops Through Real-World Examples
nrslib
5
5.1k
My daily life on Ruby
a_matsuda
3
200
HTML-Aware ERB: The Path to Reactive Rendering @ RubyKaigi 2026, Hakodate, Japan
marcoroth
0
680
Featured
See All Featured
Navigating Team Friction
lara
192
16k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.2k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
290
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
340
A Soul's Torment
seathinner
6
2.8k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
500
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
500
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
350
Typedesign – Prime Four
hannesfritz
42
3k
Embracing the Ebb and Flow
colly
88
5k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
110
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]