I have an application running with DJANGO and we are currently facing an issue where, a system dependency needs to be able to call one of our API endpoint on HTTP.

Currently, our NGNIX configuration redirects all HTTP to HTTPS.

The main problem is that same system dependency does not support redirects, so we can't rewrite or return a new HTTP URL if said location is hit. Obviously allowing HTTP globaly is not ideal, so we would rather not have to fall back to this.

We've tried many things, but we're far from getting any luck.

Apart from many trials and errors, but we dug a little and have tried going the uwsgi route, but without luck as well.

location ~ /emergency\.xml$ {
    rewrite ^(.*)? http://$host$request_uri last;
    include uwsgi_params;
    uwsgi_pass django;
        #rewrite ^(.*)? http://$host$request_uri permanent;
        # one of those two
        #return 302 http://$host$request_uri;

the rest of our the API calls are redirected to HTTPS like this

  if ($http_x_forwarded_proto = "http") {
        rewrite ^(.*)$ https://subdomain.domain.tld$REQUEST_URI permanent;

The servers are load balanced with an ELB server from AWS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.