Prev Next

API / Apollo Gateway Interview questions

How do you secure inter-service communication between the gateway and subgraphs?

Subgraphs generally shouldn't be reachable from anywhere except the gateway, and the gateway's own calls should be authenticated as coming from a trusted source.

  1. Network isolation – place subgraphs on a private network or VPC so they aren't publicly addressable at all; only the gateway/router has network access to them.
  2. Shared-secret or mTLS validation – have each subgraph check for a shared secret header or client certificate on incoming requests, rejecting anything that didn't come from the gateway.
  3. Forward and validate end-user auth – pass along the end user's token/claims (as covered under authentication) so subgraphs can still make per-user authorization decisions, not just "is this the gateway."
  4. Rotate internal service credentials regularly, the same as any other service-to-service credential.
  5. Rate limit at the gateway edge so a single misbehaving client can't flood every subgraph downstream.

These layers are complementary — network isolation stops opportunistic external access, while the shared-secret/mTLS layer stops a compromised service on the same network from impersonating the gateway.

What is the purpose of placing subgraphs on a private network or VPC?
Why is forwarding end-user auth claims to subgraphs still necessary even with gateway-to-subgraph authentication in place?

More Related questions...

What is Apollo Gateway? What is GraphQL Federation? What is a subgraph in Apollo Federation? What is a supergraph in Apollo Federation? What is the difference between Apollo Server and Apollo Gateway? What is Apollo Federation 2? What are entities in Apollo Federation? What is the @key directive used for? What is schema composition in Apollo Federation? What is managed federation? What is Apollo Studio / GraphOS? What is Rover CLI used for? What is a query plan? What are the main directives used in Apollo Federation? What is the difference between Apollo Gateway and Apollo Router? Why do we use Apollo Federation instead of GraphQL schema stitching? How does Apollo Gateway compose a supergraph? How does the @external directive work? How does the @requires directive work? How does the @provides directive work? What is the difference between @shareable and @override? When should you use Apollo Router instead of Apollo Gateway? How do you configure Apollo Gateway with Apollo Server? What happens when a subgraph is unavailable at runtime? How does Apollo Gateway handle authentication and authorization? Why doesn't Apollo Gateway support GraphQL subscriptions as robustly as Apollo Router does? What is the difference between Federation 1 and Federation 2? How do you debug query planning issues in Apollo Gateway? What is the difference between IntrospectAndCompose and managed federation in Apollo Gateway? How can you optimize Apollo Gateway performance? Explain the lifecycle of a GraphQL request through Apollo Gateway? Explain the internal working of entity resolution using _entities and reference resolvers? What is the difference between a monolithic GraphQL server and a federated Apollo Gateway architecture? How does Apollo Gateway handle errors returned by subgraphs? What is the purpose of the _service and _entities fields in a federated subgraph schema? How do you implement custom middleware or plugins in Apollo Gateway? What are contract variants in GraphOS? How do you handle the N+1 query problem when a field spans multiple subgraphs? What is the difference between @override and @external for migrating fields? How does Apollo Gateway / Router handle caching? Explain the execution flow of a federated query spanning three subgraphs? Which is better and why: Apollo Router or Apollo Gateway, for a high-throughput production system? How do you secure inter-service communication between the gateway and subgraphs? What are Automatic Persisted Queries (APQ) and how do they work with Apollo Gateway? How do you handle versioning and backward compatibility of subgraph schemas? What is the difference between self-hosted Apollo Router and the GraphOS Router (cloud)? How do you troubleshoot composition errors when publishing a new subgraph schema? Explain the internal working of query plan caching? How can you implement rate limiting at the Apollo Gateway or Router level? What is the future direction of Apollo Gateway compared to Apollo Router?
Show more question and Answers...


Comments & Discussions