fix: add CORS headers to GraphQL responses by Syroxivoss · Pull Request #11987 · appwrite/appwrite · GitHub
Skip to content

fix: add CORS headers to GraphQL responses#11987

Open
Syroxivoss wants to merge 2 commits intoappwrite:1.9.xfrom
Syroxivoss:fix-11959-graphql-cors
Open

fix: add CORS headers to GraphQL responses#11987
Syroxivoss wants to merge 2 commits intoappwrite:1.9.xfrom
Syroxivoss:fix-11959-graphql-cors

Conversation

@Syroxivoss
Copy link
Copy Markdown

What does this PR do?

Fixes GraphQL POST responses so they include the same CORS/security headers already returned by the preflight path.

Root cause:

  • the global security/CORS init hook in app/controllers/general.php only applied to the api and web groups
  • GraphQL routes are registered under the graphql group, so successful /v1/graphql POST responses skipped that header injection path

This PR:

  • includes the graphql group in the global CORS/security init hook
  • adds a focused GraphQL E2E regression test asserting CORS headers are present on a successful POST /graphql response

Test Plan

  • Verified the edited files have no editor diagnostics in this environment.

  • Full Docker E2E execution could not be run here because the docker CLI is unavailable.

  • Recommended focused validation in a full local Appwrite environment:

    docker compose exec appwrite test tests/e2e/Services/GraphQL/ContentTypeTest.php --filter=IncludesCorsHeaders

Related PRs and Issues

Closes #11959

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 23, 2026

Comment thread tests/e2e/Services/GraphQL/ContentTypeTest.php Outdated
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.

GraphQL endpoint omits CORS headers on POST responses (preflight works, actual response doesn't)

1 participant