title: Error sending request to origin. Apollo Engine how to configure apollo engine origins?
body: <p>I'm trying to make a request to my <code>/graphiql</code> IDE and I'm getting timeout errors referring to my origin. </p>
  
  <blockquote>
    <p>ERRO[0515] Error sending request to origin. This means that the origin GraphQL server did not respond to theproxied request in time. To resolve this, verify the Origin specification in the Engine configuration matches the corresponding GraphQL server. If the error was a timeout error, consider increasing <code>origin.requestTimeout</code> in the Engine configuration.  error="Post <a href="http://127.0.0.1:51301/graphql" rel="nofollow noreferrer">http://127.0.0.1:51301/graphql</a>: net/http: request canceled (Client.Timeout exceeded while awaiting headers)" url="http://127.0.0.1:51301/graphql"</p>
  </blockquote>
  
  <p>bare in mind that the url (<a href="http://127.0.0.1:51301/graphql" rel="nofollow noreferrer">http://127.0.0.1:51301/graphql</a>) port changes on each run so this leads me to believe it must be the url that the apollo engine proxy is working off as nothing on my server would change port number like that. </p>
  
  <p>My apollo engine config is like this </p>
  
  <pre><code>import { ApolloEngine } from "apollo-engine";
  import { ENGINE_API_KEY, PORT } from "../config/keys";
  import { INFO } from "./utils/logging";
  
  import app from './app';
  
  const LOG_START = () =&gt; INFO(`Listening! at port: ${PORT}`);
  
  /*
    setup Apollo Engine
  */
  const engine = new ApolloEngine({
    apiKey: process.env.ENGINE_API_KEY || ENGINE_API_KEY,
  });
  
  /*
    Config for Apollo Engine to serve
  */
  const ENGINE_SERVE = {
    port: PORT,
    graphqlPaths: ["/graphql"],
    expressApp: app,
    launcherOptions: {
      startupTimeout: 3000
    }
  };
  
  /*
    Entry point for application starts server
  */
  engine.listen(ENGINE_SERVE, LOG_START);
  </code></pre>
  
  <p>My port number is <code>:8080</code> </p>
  
  <p>and my Apollo server is set up like this </p>
  
  <pre><code>import cors from "cors";
  import morgan from "morgan";
  import express from "express";
  import bodyParser from "body-parser";
  import compression from "compression";
  import { graphqlExpress, graphiqlExpress } from "apollo-server-express";
  
  import connectDb from "./connectors/mongo-connector";
  import schema from "./schemas/schema";
  
  /*
    Create express application
  */
  const app = express();
  
  /*
    Configure graphql server
  */
  const GRAPH_EXPRESS = graphqlExpress({
    schema,
    tracing: true,
    context: { db: async () =&gt; await connectDb() }
  });
  
  /*
    Configure Graphql IDE for testing
  */
  const GRAPH_IDE = graphiqlExpress({ endpointURL: "/graphql" });
  
  /*
    Middleware and route handlers
  */
  app.use(cors());
  app.use(morgan("dev"));
  app.use(compression());
  app.use("/graphql", bodyParser.json(), GRAPH_EXPRESS);
  app.use("/graphiql", GRAPH_IDE);
  
  export default app;
  </code></pre>
  
  <p>I'm not understanding why my requests aren't being returned I've tried</p>
  
  <p>Increasing my origin timeout and explicitly setting my origin in my engine config. But I can't set the URL the error says as the port changes each time so I'm a bit at a loss any help would be appreciated.</p>
  
  <pre><code>"origins": [
      {
        "http": {
          "requestTimeout": "60s",
          "url": "http://localhost:8080/graphql",
          "overrideRequestHeaders": {
            "Host": "localhost"
          }
        }
      }
    ]
  </code></pre>