Disable apollo studio from production

I want to completely disable apollo studio UI from production, I don’t want to deliver any html content to the browser, I’ve been trying to understand how to do this with a custom plugin with not much luck the closes I can come to is rendering an htmlPage that’s empty… but I want to return a 404 not found instead.

Any help on this would be greatly appreciated, not sure why there’s not a helper method to inspect the header and look at the accept text/html and shortcut the rendering.
For example

  options: ApolloServerPluginLandingPageGraphQLPlaygroundOptions = Object.create(null)
): ApolloServerPlugin {
  return {
    async serverWillStart(...params): Promise<GraphQLServerListener> {
      return {
        //eslint-disable-nextline

        async renderLandingPage() {
          return {
            html: "404 Not Found",
          };
        },
      };
    },
  };
}
Thank you.

API Reference: Landing page plugins - Apollo GraphQL Docs

Is this not sufficient?

No, i want a 404 not a blank page using apollo-express server gets me close.

Ok, so I just tested this and it works on my end.

            {
                __internal_installed_implicitly__: false,
                async serverWillStart() {
                    return {
                        async renderLandingPage() {
                            return {
                                html: `
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
    </head>
    <body>
test                            
    </body>
</html>

                                `
                            }
                        }
                    }
                } 
            }

I don’t know what the __internal_installed_implicitly__ is for, I just copied the example from their code to test.

But if I put this exact code in my plugins array, it works, I see the test text when I try to load the landing page.

Hope it helps.

Right, but this renders an html page, i want a 404 not found page.

I used express to accomplish this by using the apollo-server-express module, this works better for my needs. I am not sure why the Apollo team thought it was a good idea to override the applyMiddleware function in ApolloServer, it would have been faster if i could have just passed my middleware auth control function into an array, for my needs to lock down some middleware logic… Also, this bug was something I observed. I think using custom middleware rather than rendering a blank html page is better. I don’t want people browsing our API explorers or even knowing one exists without access control. Also, it looks very curious that Apollo Studio rewrites the hostname, it looks like very suspicious to our security group.

https://github.com/apollographql/apollo-server/issues/6592