Edgio
Edgio

edgio.config.js Configuration

The edgio.config.js config file in your app’s root directory contains configuration options that control how your app runs on Edgio. This file is automatically created when you run edgio init. It should export an object with the following properties:

backends

The backends config is an object whose keys are backend names and whose values are:

PropertyTypeDescription
domainOrIpString(Required) The domain or ip address for the backend site or API.
hostHeaderStringA value to send as the host header when sending requests to the backend site or API. By default the host header sent from the browser is used.
disableCheckCertBooleanA flag to turn off the TLS certificate check when making proxy requests to the backend site or API. By default it is false and for security purposes we strongly recommend that it is kept false in production environments. When using this option, you may also want to run your app with the NODE_TLS_REJECT_UNAUTHORIZED environment variable set to “0” to allow node to fetch from sites with invalid certificates.
portNumberThe port on which the backend receives https requests. Defaults to 443 but you can specify any other acceptable port value. Note that specifying 80 has no special meaning as Edgio will never send secured requests to unsecured backends. To enable HTTP traffic on a backend you must have a route matching http protocol in your router and serve content from that route. All HTTP traffic assumes port 80 on the backend.

connector

The name of the connector package corresponding to the framework your app uses, or the path to a directory that implements the connector interface.

Example

To use a connector package:

JavaScript
1module.exports = {
2 connector: '@edgio/next',
3};

To implement a connector directly within your project:

JavaScript
1// this directory should have build.js, prod.js, and dev.js
2module.exports = {
3 connector: './path/to/connector/dir'
4};

routes

The path to your routes file relative to the root of your app. Defaults to routes.js.

includeNodeModules

If true, the packages listed in the dependencies property of package.json will be included in the build that is deployed to Edgio.

includeFiles

Allows you to include additional resources in the bundle that is deployed to Edgio’s serverless JS workers. Keys are globs, value can be a boolean or string. This is typically used to ensure that resources that need to be dynamically required at runtime such as build manifests for server-side rendering or other config files are present in the cloud.

Examples

JavaScript
1includeFiles: {
2 'lang/**/*': true,
3},

or if you need to copy into a specific directory within the Edgio build:

JavaScript
1includeFiles: {
2 'lang/**/*': 'another/dir/lambda',
3},

Keys (globs) with value as false (boolean) will not remove the referenced resources from the build.

prerenderConcurrency

The maximum number of URLs that will be concurrently prerendered during deployment when static prerendering is enabled. Defaults to 200, which is the maximum allowed value.

sources

A list of glob patterns identifying which source files should be uploaded when running edgio deploy --includeSources. This option is primary used to share source code with Edgio support personnel for the purpose of debugging. If omitted, edgio deploy --includeSources will result in all files which are not gitignored being uploaded to Edgio.

Example:

JavaScript
1sources: [
2 '**/*', // include all files
3 '!(**/secrets/**/*)', // except everything in the secrets directory
4]

Example edgio.config.js

JavaScript
1// This file was automatically added by edgio deploy.
2// You should commit this file to source control.
3module.exports = {
4 backends: {
5 origin: {
6 // The domain name or IP address of the origin server
7 domainOrIp: "example.com",
8
9 // When provided, the following value will be sent as the host header
10 // when connecting to the origin. If omitted, the host header from
11 // the browser will be forwarded to the origin.
12 hostHeader: "example.com",
13
14 // Uncomment the following line if TLS is not set up properly on the
15 // origin domain and you want to ignore TLS errors
16 disableCheckCert: true,
17
18 // Overrides the default ports (80 for http and 443 for https) and
19 // instead use a specific port when connecting to the origin
20 port: 1337,
21 },
22 },
23
24 // The name of the site in Edgio to which this app should be deployed.
25 name: "example.com",
26
27 // The name of the team in Edgio to which this app should be deployed.
28 team: 'my-team-name',
29
30 // Overrides the default path to the routes file. The path should be relative
31 // to the root of your app.
32 routes: 'routes.js',
33
34 // The maximum number of URLs that will be concurrently prendered during
35 // deployment when static prerendering is enabled. Defaults to 200, which is
36 // the maximum allowed value.
37 prerenderConcurrency: 200,
38
39 // A list of glob patterns identifying which source files should be uploaded
40 // when running edgio deploy --includeSources. This option is primarily used
41 // to share source code with Edgio support personnel for the purpose of
42 // debugging. If omitted, edgio deploy --includeSources will result in all
43 // files which are not gitignored being uploaded to Edgio.
44 //
45 sources : [
46 '**/*', // include all files
47 '!(**/secrets/**/*)', // except everything in the secrets directory
48 ],
49
50 // Set to true to include all packages listed in the dependencies property
51 // of package.json when deploying to Edgio. This option generally isn't
52 // needed as Edgio automatically includes all modules imported by your
53 // code in the bundle that is uploaded during deployment
54 //
55 includeNodeModules: true,
56};