Multiple graphql backend. What is the best approach?

Hi everybody!

I have an app that uses graphql with multiple backends. 90% of requests are served by the inner backend, while the others need to go through 2 different remote graphql server. The client should send a parameter to tell the server where the query is supposed to be executed. I don’t want to remap all the types from the remote graphql backends, and I’d like the absinthe_plug to act like a proxy in these cases.

What do you think could be an elegant approach to achieve this?

I’m trying with a plug in the pipeline that send out the query and calls send_resp on the connection. But I get an error from absinthe when it tries to execute the query on the local schema. Is there a way to block the absinthe pipeline?

3 Likes

So is the entire query executed on the remote server in those cases? If so then you’d want to avoid Absinthe entirely for those requests and handle the change at the plug level. Think about how you’d accomplish this if you were only sending requests to these remote servers.

1 Like

this is the idea, but as far as I know there is no way to stop the absinthe pipeline from a plug, and I don’t want to use another endpoint…