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
Reading Rails 1.0 Source Code
okuramasafumi
0
240
基礎から学ぶ大画面対応(Learning Large-Screen Support from the Ground Up)
tomoya0x00
0
1.5k
プロパティベーステストによるUIテスト: LLMによるプロパティ定義生成でエッジケースを捉える
tetta_pdnt
0
1.7k
パッケージ設計の黒魔術/Kyoto.go#63
lufia
3
440
複雑なフォームに立ち向かう Next.js の技術選定
macchiitaka
2
140
チームのテスト力を鍛える
goyoki
3
190
Oracle Database Technology Night 92 Database Connection control FAN-AC
oracle4engineer
PRO
1
450
JSONataを使ってみよう Step Functionsが楽しくなる実践テクニック #devio2025
dafujii
1
530
CJK and Unicode From a PHP Committer
youkidearitai
PRO
0
110
複雑なドメインに挑む.pdf
yukisakai1225
5
1.2k
AIと私たちの学習の変化を考える - Claude Codeの学習モードを例に
azukiazusa1
10
4.2k
Cache Me If You Can
ryunen344
2
1.4k
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
920
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
8
530
A designer walks into a library…
pauljervisheath
207
24k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
30
9.7k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.1k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
51
5.6k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.5k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
Designing Experiences People Love
moore
142
24k
The Art of Programming - Codeland 2020
erikaheidi
56
13k
[RailsConf 2023] Rails as a piece of cake
palkan
57
5.8k
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]