3 ms·
> Why’s there so much data in the url? A common refrain I’ll use for the remainder of the post is, “I don’t know”. One of my biggest gripes with web programming
by jldugger 7y ago
> Why’s there so much data in the url? A common refrain I’ll use for the remainder of the post is, “I don’t know”. One of my biggest gripes with web programming is the number of rabbit holes to fall down. There’s just not enough time.
I mean, bioinformatics is _notorious_ for spending just enough time working on software to publish a result and no more. If we want to talk about rabbitholes I nominate BioPerl.
> here are a list of terms that you’d never come across as a bioinformatician: ["X-Forwarded-Proto", "proxying", "requests", "TLS connection", "HTTP", "loopback/localhost", "whitelisted proxy servers", "gunicorn", "nginx", "Apache/httpd", "HAProxy", "Django", "SECURE_SSL_REDIRECT", "SecurityMiddleware", "adapter", "URI"]
This list is more than a little disingenuous:
Django: This is like, the framework OP built their software on top of. I don't know how one gets the point of filing this bug without knowing the term Django
requests: literally, a user's web request.
HTTP/URI: this is the web developer equivalent of a biologist not knowing the term DNA. Or DOI for that matter.
whitelist: the opposite of a blacklist
Much of rest comes down to the simple fact that job of web developers is to build a network service. This is primarily done with layers; each layer only needs to know how to interface with the adjoining layers above and below, like a lego brick. This is actually a _solution_ to the complexity, allowing us to constrain the design of each layer to interact only with those above and below it. This layer abstraction lets us reason about each layer locally, independently of the system as a whole.
nginx, Apache/httpd, HAProxy: in this context, mentioned as possible proxies forming the outermost layer. in this context, accepts HTTP/HTTPS connections and makes HTTP connections to gunicorn
gunicorn: the thing that runs the Django app. Accepts HTTP connections, makes WSGI calls to the Django app
Django: Accepts WSGI function calls, routes them through middleware, then to the app as you define in urlpatterns
SecurityMiddleware: a class that potentially modifies inbound requests and outbound responses
Finally, OP is in the unhappy situation of bridging two network protocols: HTTP and email. The normal trick of using a protocol relative URI will not work here because you've gone outside the browser request-response loop. This puts them in the unhappy state of the lowest layer needing to know the details of the highest layer, hence the discussion of absolute uris. This is a direct violation of the local reasoning constraint, and what makes all of this hard.
X-Forwarded-Proto: An HTTP header, added to incoming HTTP requests designed to indicate to layers below which URI scheme was originally used, HTTP or HTTPS.
SECURE_SSL_REDIRECT: a setting for SecurityMiddleware that will stop processing the request and send a response to the browser telling it to resend the query over https (an HTTP 302 redirect), if the incoming connection is seen as coming over not http.
tl;dr: email is the thing that sucks.