Debian Codegraph @

docs/headless/cors.rst

raw
1 Cross-Origin Resource Sharing (CORS)
2 ====================================
3
4 In case your project requires CORS handling, the following configuration can be
5 used as a starting point:
6
7 .. code-block:: python
8
9 MIDDLEWARE = (
10 ...
11 "corsheaders.middleware.CorsMiddleware",
12 ...
13 )
14
15 INSTALLED_APPS = (
16 ...
17 "corsheaders",
18 ...
19 )
20
21 CORS_ALLOWED_ORIGINS = [
22 "https://app.project.org",
23 ]
24
25 from corsheaders.defaults import default_headers
26
27 CORS_ALLOW_HEADERS = (
28 *default_headers,
29 "x-session-token",
30 "x-email-verification-key",
31 "x-password-reset-key",
32 )
33 CORS_ALLOW_CREDENTIALS = True