lundi 29 juin 2015

Django-storages to serve different urls (HTTP or HTTPS) to different users?

Right now my site is widely used behind one corporate network. For whatever reason, they refuse to connect to the recent HTTPS version of my site and I can't back into why. I've settled on the idea that they have issues in their backend.

Until I figure a workaround, I thought I would take them back the non-ssl version of my site. I'm not sure what the best design pattern here is with django-storages. Right now in my settings file I have:

AWS_PRELOAD_METADATA = True
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
STATICFILES_STORAGE = 'tiingo.s3pipeline.S3PipelineStorage'
AWS_STORAGE_BUCKET_NAME = 'media.website.com'
AWS_S3_SECURE_URLS = True
AWS_S3_CUSTOM_DOMAIN =  "media.website.com"

I'm not sure the best design pattern on how to read if the user is coming from http or https and then serve the secure URLs or not.

If I wasn't using pipeline and storages, I could directly choose to load in different .css or .js files on the template site, but that would feel to hacky here.

Any ideas?




Aucun commentaire:

Enregistrer un commentaire