Skip to content

[Ficus] Enable CORS headers http referee replace and middleware - #138

Merged
melvinsoft merged 2 commits into
appsembler/ficus/developfrom
maxi/ficus-cors-headers-workaround
Jul 18, 2017
Merged

[Ficus] Enable CORS headers http referee replace and middleware#138
melvinsoft merged 2 commits into
appsembler/ficus/developfrom
maxi/ficus-cors-headers-workaround

Conversation

@melvinsoft

@melvinsoft melvinsoft commented Jul 18, 2017

Copy link
Copy Markdown

This PR includes settings to allow us to use CORS headers requests when we're running under HTTPS. When we're using django-cors-headers properly configured, we're able to retrieve the csrf external cookie, but when we want to make a POST request from the external domain is working under HTTP but not under HTTPS since the referer is passed, and is blocked if it's external.
See the Django's docs (point 4)

In Django 1.9 a new settings has been added to allow to set the white listed domains that can make request, but since this settings is not available until Django 1.9, we need to use the django-cors-headers workaround.

@melvinsoft melvinsoft changed the title Enable CORS headers http referee replace and middleware [Ficus] Enable CORS headers http referee replace and middleware Jul 18, 2017
@melvinsoft

Copy link
Copy Markdown
Author

Comment thread lms/envs/aws_appsembler.py Outdated
# removing the database alias
del DATABASES['appsembler_usage']

if FEATURES.get('ENABLE_CORS_HEADERS'):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as my comment in the other PR:

Let's set a default value for this get method in case it's not correctly set in the env:

FEATURES.get('ENABLE_CORS_HEADERS', False)

@melvinsoft

Copy link
Copy Markdown
Author

@tkeemon Same as the other PR:

Thanks for reviewing this, I've added the default for the settings, and also I've removed the middleware, I know is recommended, but not mandatory, and breaking the external requests again, and working without it, so I think we can remove it.

@tkeemon tkeemon left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@melvinsoft
melvinsoft merged commit ebe656c into appsembler/ficus/develop Jul 18, 2017
@melvinsoft
melvinsoft deleted the maxi/ficus-cors-headers-workaround branch July 18, 2017 18:50
OmarIthawi pushed a commit that referenced this pull request Aug 11, 2018
EDUCATOR-3206: Fix chemical equations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants