Categories
Posts

Serving your Django app’s static & media files with S3 and CloudFront (super fast & easy!)

The following steps will leave you with an AWS setup for serving your app’s files via xyz123.cloudfront.net URLs: Create an S3 bucket (e.g. my-app-bucket-staging) and leave all settings at their defaults Open the newly created bucket and navigate to Permissions → CORS configuration Create an XML CORSConfiguration that defines from which domain the contents of […]

Categories
Posts

Stop Firefox from redirecting to HTTPS

I don’t know anything about your web stack except for one thing: You’ve landed here because you are facing the same annoying problem I had with Django’s SECURE_SSL_REDIRECT. After accidentally enabling this option in my local dev environment, the world’s favorite browser kept redirecting all localhost URLs to their https counterparts. This was super annoying […]

Categories
Posts

A minimal reverse proxy using PHP & cURL

A reverse proxy acts as an intermediary between a client and one or more servers. Requests sent by the client are received by the proxy and passed on to one of the servers in the background. There are many scenarios in which such a setup might be useful. For example, reverse proxies can be used […]

Categories
Posts

Whitelisting files in Serverless

By default, the Serverless framework will deploy every file in the project directory. In most cases, this is not what you want. serverless.yml offers the option to control which files will be deployed to your cloud provider by using the exclude / include parameters. Due to the way these parameters are implemented, it is not […]

Categories
Posts

Busting some caches with Django

In contrast to server-side code, client-side assets such as JavaScript files and static images are not directly deployed to where they are ultimately executed or displayed (i.e. the user’s browser). Rather, they are downloaded on demand whenever a browser retrieves a page for the first time. For sake of efficiency, the browser saves the retrieved […]