adamchainz / django-cors-headers

Django app for handling the server headers required for Cross-Origin Resource Sharing (CORS)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CORS_ALLOWED_ORIGINS & co to be set at runtime specifically for each user

esseti opened this issue · comments

Is it possible, somehow, to have the value set at runtime depending on which customer is making the call?
such as for example, having different values for different subdomain (e.g. customer1.mysite.com -> customer1.com , customer2.mysite.com -> customer2.net)

I know it's an edge case, but if feasible i would love is someone can point out how it can be done in theory so we can play with the pacakge and extend it.

thanks.

Subclass the middleware and override process_response to first call super(), then do whatever logic you want to change the headers as you see fit.