1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-29 22:01:14 +03:00

Add CORS headers for /graphql

This commit is contained in:
Hugh Nimmo-Smith
2023-09-01 16:20:49 +01:00
committed by Quentin Gliech
parent a01c53019f
commit bca3ab5eb6

View File

@ -116,10 +116,23 @@ where
Encrypter: FromRef<S>,
CookieJar: FromRequestParts<S>,
{
let mut router = Router::new().route(
"/graphql",
get(self::graphql::get).post(self::graphql::post),
);
let mut router = Router::new()
.route(
"/graphql",
get(self::graphql::get).post(self::graphql::post),
)
.layer(
CorsLayer::new()
.allow_origin(Any)
.allow_methods(Any)
.allow_otel_headers([
AUTHORIZATION,
ACCEPT,
ACCEPT_LANGUAGE,
CONTENT_LANGUAGE,
CONTENT_TYPE,
]),
);
if playground {
router = router.route("/graphql/playground", get(self::graphql::playground));