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
モテるデスク環境
mozumasu
3
1.1k
CSC509 Lecture 07
javiergs
PRO
0
240
Go言語の特性を活かした公式MCP SDKの設計
hond0413
1
440
フロントエンド開発のためのブラウザ組み込みAI入門
masashi
7
3.4k
エンジニアインターン「Treasure」とHonoの2年、そして未来へ / Our Journey with Hono Two Years at Treasure and Beyond
carta_engineering
0
410
pnpm に provenance のダウングレード を検出する PR を出してみた
ryo_manba
1
150
Writing Better Go: Lessons from 10 Code Reviews
konradreiche
3
5.8k
Six and a half ridiculous things to do with Quarkus
hollycummins
0
210
Webサーバーサイド言語としてのRustについて
kouyuume
1
4.1k
組込みだけじゃない!TinyGo で始める無料クラウド開発入門
otakakot
2
360
AI Coding Meetup #3 - 導入セッション / ai-coding-meetup-3
izumin5210
0
3.4k
AI Agent 時代的開發者生存指南
eddie
4
2.1k
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
463
33k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
15k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.2k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
657
61k
It's Worth the Effort
3n
187
28k
Leading Effective Engineering Teams in the AI Era
addyosmani
7
570
YesSQL, Process and Tooling at Scale
rocio
173
15k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Designing for humans not robots
tammielis
254
26k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.7k
Thoughts on Productivity
jonyablonski
70
4.9k
Unsuck your backbone
ammeep
671
58k
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]