Skip to Content

http

The http configuration object allows you to customize the network interface and port that the Hive Router listens on for incoming GraphQL requests.

Options

host

  • Type: string
  • Default: "0.0.0.0"
  • Environment Variable: HOST

The host property specifies the IP address to which the router’s HTTP server will bind.

  • "0.0.0.0": Binds to all available network interfaces. This is the standard for services running inside containers.
  • "127.0.0.1" or "localhost": Binds only to the local loopback interface, meaning the router will only be accessible from the same machine.

port

  • Type: integer
  • Default: 4000
  • Environment Variable: PORT

The port property specifies the network port that the router will listen on. Ensure this port is not already in use by another service on the same host. When running in a container, this is the port you will need to expose.

Example

This example configures the router to listen only on the localhost interface on port 8080.

router.config.yaml
http: host: '127.0.0.1' port: 8080

graphql_endpoint

  • Type: string
  • Default: "/graphql"

The graphql_endpoint property allows you to customize the HTTP path where the GraphQL API is exposed. By default, Hive Router serves the GraphQL API at the /graphql endpoint.

For example, to change the GraphQL endpoint to /api/graphql, you would configure it as follows:

router.config.yaml
http: graphql_endpoint: /api/graphql

This configuration is useful if you want to namespace your GraphQL API under a specific path or if you have multiple services running on the same domain and want to avoid path conflicts.

You can also use path parameters in the graphql_endpoint to capture dynamic segments of the URL. This can be useful such features like Persisted Documents where the document ID can be part of the URL path.

path_params will be available in the request object inside the VRL expression context for further processing.

Learn more about using path parameters with Persisted Documents. Learn more about the request object in the VRL expressions.

router.config.yaml
http: graphql_endpoint: /graphql/:doc_id persisted_documents: enabled: true spec: expression: .request.path_params.doc_id
Last updated on