hasura / hasura/graphql-engine

Auth: `Hasura_Graphql_Auth_Hook` custom http headers from auth endpoint are not forwarded to response via Ngnix

Open
#8,803 3 comments 0 reactions 0 assignees View on GitHub
a/authz t/gql-services
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Discussed in https://github.com/hasura/graphql-engine/discussions/8802

Originally posted by **geeksquad87** August 16, 2022
I configured a NodeJs based simple POST Rest API as Authentication Endpoint for Hasura_Graphql_Auth_Hook . In my Auth WebHook endpoint, I am adding a custom header after validating the Authorization header received from original GraphQl Request. (Works fine)
After Authenticating, I am setting a Custom header using (Express).Response.setHeader("MyCustomHeader","MyCustomValue") to the response headers. If I run the POST Authentication Endpoint directly from Postman, I can see the Custom Header in the Response correctly.
However when I run the Hasura Engine GraphQL POST Endpoint configured with POST HTTP Auth Endpoint as Hasura_Graphql_Auth_Hook , the custom header added in the Authentication Endpoint is not received in the final response. I am using Envoy for reverse proxy. I had added logging in Envoy, and I do not see Custom Header in the Envoy Http Filters either.

This looks like a defect,
My end goal is, add a Custom Header from Auth Web Hook's Auth Endpoint. Based on the custom header, I want to change the status code in the Final Response using Envoy.

Contributor guide

Open the contributing guide

Research direction

The issue names no source files or tests. Reproduce the flow with the Node.js authentication endpoint, the Hasura GraphQL POST endpoint, and the Envoy reverse proxy, then trace whether the auth webhook response headers are retained; done means the custom header is visible in the final response or the limitation is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, nginx, node.js
Domain
api, authentication, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.