AWS
Configuration

Build Arguments

There is two build arguments that you can pass to the open-next build command:

  • --config-path - This is the path to the configuration file that you want to use. By default, it will look for open-next.config.ts in the current working directory. This needs to be relative to the current working directory.
  • --node-externals - You can configure externals for the esbuild compilation of the open-next.config.ts file (i.e --node-externals @aws-sdk/*,open-next/dist/queue/*)

Configuration File

For personalisation you need to create a file open-next.config.ts at the same place as your next.config.js, and export a default object that satisfies the OpenNextConfig interface. It is possible to not have an open-next.config.ts file, the default configuration will then be applied automatically.

This file needs to be placed at the same level as your next.config.js file.

If you have an open-next.config.ts file, make sure you have atleast this:

export default {
  default: {},
};

If you want to take a look at some simple configuration examples, you can check the simple example.

For more advanced use cases, you can check how to implement custom overrides.

If you want to look at a full example, you can check the full example.

Opt out of default poweredByHeader

By default Next.js will add the x-powered-by (opens in a new tab) header. OpenNext will also add a header x-opennext. To opt-out of this, open next.config.js and disable the poweredByHeader property in the configuration:

module.exports = {
  poweredByHeader: false,
}