I am using Apollo gateway to build a graphql federation service. Below is the demo code:
const gateway = new ApolloGateway({
supergraphSdl: new IntrospectAndCompose({
subgraphs: [
{ name: 'products', url: 'https://products-service.dev/graphql' },
{ name: 'reviews', url: 'https://reviews-service.dev/graphql' },
],
introspectionHeaders: {
Authorization: 'Bearer abc123',
},
}),
});
As you can see there are 2 subgraphs products
and reviews
, and there is also a introspectionHeaders
which gives authorization. My questions is:
- How can I specify different header for different subgraph? In above example, the header applies on both subgraph