Skip to content

Latest commit

 

History

History
50 lines (38 loc) · 848 Bytes

File metadata and controls

50 lines (38 loc) · 848 Bytes

nginx-disable-graphql-introspection

Disable GraphQL Introspection in Nginx using JS Module

http {

   ....
   server {
     ....
   }

}
  • in http scope, import the js file
js_import /etc/nginx/njs/introspect.js;
  • Add upstream to your Graphql backend
   # http scope
   upstream backend {
       # graphql server
       server localhost:8080;
   }
   
   # server scope
     location @app-backend {
       proxy_pass http://backend;
     }
  • validate all of requests with js code
     location / {
       js_content introspect.disableSchema;
     }