pixelpassion / django-saas-boilerplate

A Django + django-rest-framework + Heroku + SaaS application boilerplate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cors handling update

AntonDnepr opened this issue · comments

😱 What is happening? What did you expect instead?

Cors not working for frontend.
Proposed chat solution:

from corsheaders.defaults import default_headers

CORS_ORIGIN_ALLOW_ALL = env.bool("CORS_ORIGIN_ALLOW_ALL", default=False)

CORS_ORIGIN_WHITELIST = CSRF_TRUSTED_ORIGINS = env.list("CORS_ORIGIN_WHITELIST")

CORS_ALLOW_CREDENTIALS = True

CORS_ALLOW_HEADERS = default_headers + (
    "If-None-Match",
    "Last-Modified",
    "Accept-Language",
    "If-Modified-Since",
    "Access-Control-Allow-Origin",
)

CORS_EXPOSE_HEADERS = (
    "ETag",
    "Last-Modified",
    "HTTP_X_RESPONSE_ID",
    "HTTP_GIT_BRANCH",
    "Access-Control-Expose-Headers",
)

☝️ Steps to reproduce

🐛 More details (Sentry link, etc.)

🚨 Priority

  • Major problem (System not working at all)
  • Very high (Urgent fix needed)
  • [] High, but handled later
  • Medium
  • Low

Should work after #22