Open bitjson opened 3 years ago
As an example, I ended up switching away from Hasura Cloud, so I was able to implement this outside of Hasura for https://demo.chaingraph.cash. (Automatically redirects to https://try.chaingraph.cash.)
any solution found here ?
Is your proposal related to a problem?
I'm serving a public API with Hasura which I would like to make easy for developers to start using. Right now, developers who are new to the API sometimes attempt to navigate to
https://api.example.com/
, where they see only:Developers also occasionally send GET requests to
/v1/graphql
, where they see the same error. (Which can be particularly confusing – its plausible that they made a valid request but the server didn't find any results.)Describe the solution you'd like
I'd like Hasura to send back a 302 redirect to a helpful URL from the
HASURA_GRAPHQL_REDIRECT_GET_REQUESTS
environment variable, e.g.https://docs.example.com
orhttps://try.example.com
(where I've set up graphql-playground preset to my API).If Hasura is considering rendering some sort of standard, more descriptive error message on GET requests to
/v1/graphql
, it might instead be a good idea to have two environment variables, e.g.HASURA_GRAPHQL_REDIRECT_GET_ROOT
(for redirecting traffic from/
) andHASURA_GRAPHQL_REDIRECT_GET_ENDPOINT
for redirecting GET traffic from/v1/graphql
and other endpoints (/v1beta1/relay
, etc.). A descriptive error message would be sufficient for GET requests to/v1/graphql
, but I would still like to redirect users from the roothttps://api.example.com/
to myhttps://try.example.com/
.Describe alternatives you've considered
If I was running my own infrastructure, I could do this myself, but since I'm using Hasura Cloud, I can't even e.g. configure Kubernetes ingress rules or CDN rules. I'm stuck with the error messages unless I migrate off of Hasura Cloud.
If the feature is approved, would you be willing to submit a PR?
Certainly! (Though I'm very new to Haskell, so I'd appreciate hints about how best to implement it.)