1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-08-07 17:03:01 +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>, Encrypter: FromRef<S>,
CookieJar: FromRequestParts<S>, CookieJar: FromRequestParts<S>,
{ {
let mut router = Router::new().route( let mut router = Router::new()
"/graphql", .route(
get(self::graphql::get).post(self::graphql::post), "/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 { if playground {
router = router.route("/graphql/playground", get(self::graphql::playground)); router = router.route("/graphql/playground", get(self::graphql::playground));