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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Max Ludwig
January 02, 2016
Programming
520
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
<title><a id="</title>君はこのHTMLをパースできるか"></a></title> #雑LT_study
pizzacat83
0
130
【やさしく解説 設計編・中級 #6】良いアーキテクチャとは ~ 一本の登り道の、行き先 ~
panda728
PRO
0
210
Built Our Own Background Agent at LayerX
layerx
PRO
9
4.8k
2年かけて Deno に DOMMatrix を実装した話 / How I implemented DOMMatrix in Deno over two years
petamoriken
0
200
Foundation Models frameworkで画像分析
ryodeveloper
1
510
FDEが実現するAI駆動経営の現在地
gonta
2
260
作るコストが小さくなった時代 幸せに働くために改めて考えたいこと 〜エンジニアとして価値を出し続けるために注視している二分野〜
yuppeeng
0
180
Terraform標準の組織で AWS CDKをどう使うか
mu7889yoon
1
470
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
520
なぜ関数型プログラミングで「型」と「証明」が語られるのか #fp_matsuri
kajitack
3
1.1k
AI時代のPHPer生存戦略 ~「言語、もうなんでもよくない?」に本気で向き合う~
vivion
0
240
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
480
Featured
See All Featured
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
64
56k
Balancing Empowerment & Direction
lara
6
1.2k
Un-Boring Meetings
codingconduct
0
370
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Google's AI Overviews - The New Search
badams
0
1.1k
sira's awesome portfolio website redesign presentation
elsirapls
0
320
How to Think Like a Performance Engineer
csswizardry
28
2.7k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.5k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
200
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
430
Agile that works and the tools we love
rasmusluckow
331
22k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
67k
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]