diff --git a/src/core/server/app/router/index.ts b/src/core/server/app/router/index.ts index a228f40ab..57bda4b0e 100644 --- a/src/core/server/app/router/index.ts +++ b/src/core/server/app/router/index.ts @@ -64,7 +64,7 @@ export async function createRouter(app: AppOptions, options: RouterOptions) { function attachGraphiQL(router: Router, app: AppOptions) { if (app.config.get("env") === "production") { logger.warn( - "enable_graphiql is enabled, but we're in production mode, this is not recommended" + "it is not recommended to have enable_graphiql enabled while in production mode as it requires introspection queries to be enabled" ); } diff --git a/src/core/server/graph/common/middleware/index.ts b/src/core/server/graph/common/middleware/index.ts index 4d094f59a..e7d47c292 100644 --- a/src/core/server/graph/common/middleware/index.ts +++ b/src/core/server/graph/common/middleware/index.ts @@ -28,7 +28,7 @@ export const graphqlMiddleware = ( // Generate the validation rules. const validationRules: Array<(context: ValidationContext) => any> = []; - if (config.get("env") === "production") { + if (config.get("env") === "production" && !config.get("enable_graphiql")) { // Disable introspection in production. validationRules.push(NoIntrospection); }