title: Tastypie POST Location HTTPS vs. HTTP
body: <p>When I POST a new resource to my RESTful Tastypie API, I create a resource and get a 201 response like this:</p>
  
  <pre><code>HTTP/1.1 201 CREATED
  Content-Type: text/html; charset=utf-8
  Date: Wed, 19 Sep 2012 01:02:48 GMT
  Location: http://example.com/api/v1/resource/12/
  Server: gunicorn/0.14.6
  Content-Length: 0
  Connection: keep-alive
  </code></pre>
  
  <p>Great!  Except I posted to an HTTPS URL and would like to get a HTTPS <code>Location</code> header back.  How can I configure tastypie to do this?</p>
  
  <p><strong>Addition</strong></p>
  
  <p>I am using some middleware to force SSL, but I don't think it is the cause of this issue.  Here it is anyway:</p>
  
  <pre><code>class SSLifyMiddleware(object):
      # Derived from https://github.com/rdegges/django-sslify
      def process_request(self, request):
          if not any((not settings.FORCE_SSL, request.is_secure(), request.META.get('HTTP_X_FORWARDED_PROTO', '') == 'https')):
              url = request.build_absolute_uri(request.get_full_path())
              secure_url = url.replace('http://', 'https://')
              return HttpResponseRedirect(secure_url)
  </code></pre>
  
  <p><strong>Addition</strong></p>
  
  <p>This is a Heroku app.</p>