New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overriding graphiql request path when behind proxy #970
Comments
Alternatively, the "external_path" can be reconstructed in a middleware and stored as a |
[comment removed] User error 🤠 it was an unrelated case. |
Actually, ASGI spec 2.0 includes
Maybe this can be used instead? Not sure how a user would set this value. I assume this is the ASGI server's responsibility to offer an interface for it. |
I am also having this issue as my app is behind an Apigee Edge proxy. |
Thank you for filing this issue. We have decided to deprecate GraphQL support within Starlette itself so I am going to close this issue. See #619. |
Currently, it does not seem possible to serve the graphiql client from the graphql app, behind a proxy that might modify the request url path.
For example, my application defines an endpoint at
/graphql
, and my proxy exposes my application api under path prefix/api/myapp
. The proxy strips the path prefix before forwarding the request, so that my application doesn't have to define all its endpoints using the proxy's routing prefix.The GraphQLApp uses the
request.url.path
to generate the graphiql client.starlette/starlette/graphql.py
Lines 142 to 144 in 4e2f301
This path will not be valid from outside the proxy(since it does not include the path prefix), and the resulting client code doesn't work. The proxy routing prefix must be added to the request path to generate valid client code.
A simple way to address this would be to add a parameter to the GraphQLApp constructor to specify the client-side path prefix for the api.
starlette/starlette/graphql.py
Lines 23 to 30 in 4e2f301
The text was updated successfully, but these errors were encountered: