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
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
2026年は Rust 置き換えが流行る! / 20260220-niigata-5min-tech
girigiribauer
0
220
atmaCup #23でAIコーディングを活用した話
ml_bear
4
750
開発ステップを細分化する、破綻しないAI開発体制
kspace
0
110
DevinとClaude Code、SREの現場で使い倒してみた件
karia
1
970
Fundamentals of Software Engineering In the Age of AI
therealdanvega
1
220
今、アーキテクトとして 品質保証にどう関わるか
nealle
0
200
AI主導でFastAPIのWebサービスを作るときに 人間が構造化すべき境界線
okajun35
0
610
NOT A HOTEL - 建築や人と融合し、自由を創り出すソフトウェア
not_a_hokuts
2
590
コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions
handlename
0
170
SourceGeneratorのマーカー属性問題について
htkym
0
170
nilとは何か 〜interfaceの構造とnil!=nilから理解する〜
kuro_kurorrr
3
1.7k
JPUG勉強会 OSSデータベースの内部構造を理解しよう
oga5
2
250
Featured
See All Featured
Statistics for Hackers
jakevdp
799
230k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.1k
Embracing the Ebb and Flow
colly
88
5k
Agile that works and the tools we love
rasmusluckow
331
21k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
380
Building Adaptive Systems
keathley
44
2.9k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
88
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
470
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
95
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]