Sandbox endpoint URL parameter not working
Issue Description
In a project I'm working on, the Sandbox is hosted in an URL, while the endpoint it should run introspection is in another. After we updated to Apollo v4, we realized there is no endpoint parameter when creating Apollo Server, like there used to be with the GraphQL Playground.
The closest solution I could find to that problem, would be using the endpoint URL parameter, as described here, but something is not right.
When I set our URL to https://my-url.com/graphql?endpoint=https://my-url.com/graphql/test I expect the Connection Setting endpoint to be set to https://my-url.com/graphql/test.
Instead I get https://my-url.com/graphql?endpoint=https://my-url.com/graphql/test in the Connection Setting endpoint.
Is there a way to achieve a different endpoint then the URL without changing it manually?
Link to Reproduction
https://codesandbox.io/p/devbox/modest-fermat-gv8lrv
Reproduction Steps
For some reason, codesandbox is giving error when initializing. Please run npm run start from the terminal.
Add endpoint URL param to Sandbox and check the endpoint inside Sandbox.
Is there any way to set the endpoint from code?
I want: https://my-url/graphqlexplorer to use the endpoints https://my-url/graphql
Is this possible?
Hi, I don't think is supposed to be supported. The endpoint query parameter you found documented is for the hosted version of Sandbox on Apollo's sites, not for the Apollo Server embedding. I think it would be confusing and arguably a security hole if Sandboxes embedded on arbitrary Apollo Server servers could be pointed at random other servers (that allow connections via CORS) via query param.
If you'd like to embed Apollo Sandbox on your web server in a more complex way than how the landing page plugins allow you, you can follow our general Sandbox embedding does (not specific to Apollo Server) which lets you customize the initialEndpoint: https://www.apollographql.com/docs/graphos/platform/sandbox#embedding-sandbox
In fact, this was a security fix: https://github.com/apollographql/apollo-server/issues/7735
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. For general questions, we recommend using our Community Forum or Stack Overflow.