title: Getting the request origin in a Django request
body: <p>So I'm trying to enable cross origin resource sharing in Django, so I can post to an external site, and it's easy to do when I set </p>
  
  <pre><code>response["Access-Control-Allow-Origin"]="*" 
  </code></pre>
  
  <p>but I want to instead have it check whether the origin is in an allowed list of origins (essentially to restrict it to only allow specific sites) but I can't seem to find anywhere in the Django request where I can get the origin information.</p>
  
  <p>I tried using <strong>request.META['HTTP_HOST']</strong> but that just returns the site that's being posted to. Does anyone know where in the Request object I can get the origin of the request?</p>