Skip to content

Current Cookie Implementation Faces CORS Issues #45

@A-lexisL

Description

@A-lexisL

Issue: Configure Cross-Subdomain Cookie Sharing for Authentication

Status: To Do
Context: Vue (CF Pages) and DRF (Server) are on different subdomains (atlas-api.gcers.org and atlas.gcers.org). Backend set-cookie should set browser cookies, and when frontend request backend, browser should automatically bring sessionid cookie, which is used in drf user authentication.
Further configs should be made to enable correct cookie implementation between cross-subdomain.

1. Backend Configuration (Django/DRF)

  • Update settings.py:
    • SESSION_COOKIE_DOMAIN = ".gcers.org" (Allows subdomains to access the cookie).
    • CORS_ALLOWED_ORIGINS (Whitelist frontend origin) (already implemented).
    • CORS_ALLOW_CREDENTIALS = True (Required for browser to accept cross-origin cookies).
  • Custom Cookies: Ensure temp_token is set with domain=".gcers.org".

2. Frontend Configuration (Vue)

  • Note: Ensure During deployment VITE_API_BASE_URL uses the absolute URL (https://atlas-api.gcers.org).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions