How to disable the graphql introspection in Magento 2.

As we know graphql introspection querying is enabled by default and most of the time, we wish to disable graphql introspection in production mode for security reasons. And in this article, we'll show you how to stop graphql introspection using the simplest method possible.

To disable the graphql introspection it in production mode to improve security, add the following to your app/etc/env.php file.

saveCopyzoom_out_map
'graphql' => [ 'disable_introspection' => true, ]

We need to perform the following commands now that we've updated the env file.

saveCopyzoom_out_map
php bin/magento s:up php bin/magento s:s:d -f php bin/magento setup:di:compile php bin/magento c:c

Bingo!!

All set, now use your graphql endpoint to connect to graphql. By default, it looks like this. As you can see, the graphql introspection query is no longer functional.

saveCopyzoom_out_map
https://yourDomain.com/graphql

If you are looking for more GraphQL solutions then check out our another article which is List of GraphQL Queries and Mutations for Magento 2.

I hope this article helps you to find what you were looking for.

Bookmark it for your future reference. Do comment below if you have any other questions on that.

P.S. Do share this article with your team.

Review other articles maybe it'll help you too.




Recent Articles
Tags
Newsletter
Chrome Extension
Copyright © 2024 devhooks.in All rights reserved.
Ads OFF toggle_off
wifi_off