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:origins
The
origins
config is an array of objects whose properties are:Property | Type | Description |
---|---|---|
name | String | (Required) The origin name refered within the router. |
override_host_header | String | The host header sent from the browser when connecting to the origin. This is useful when you want to connect to a backend that is configured to serve content from a different domain than the one that the browser is connecting to. For example, if you want to connect to a backend that is configured to serve content from example.com but the browser is connecting to www.example.com , you can set override_host_header to example.com to ensure that the backend receives the correct host header. |
hosts | Object[] | An array of objects that define how Edgio will proxy requests for this origin configuration. requests. |
hosts[].location | Object | Contains properties that define the location to which Edgio will proxy requests for this origin configuration. |
hosts[].location.hostname | String | (Required) The domain name or IP address of the origin server |
hosts[].location.port | Number | The 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. |
shields | Object | Defines how Edgio will shield your origin configuration. |
shields.apac | String | The POP code for the Asia Pacific shield. |
shields.emea | String | The POP code for the Europe, Middle East, and Africa shield. |
shields.us_west | String | The POP code for the US West shield. |
shields.us_east | String | The POP code for the US East shield. |
tls_verify | Object | An object that specifies how Edgio should verify the TLS certificate presented by the origin. |
tls_verify.use_sni | Boolean | Whether to use SNI when connecting to the origin. Defaults to false . |
tls_verify.sni_hint_and_strict_san_check | String | SNI hint and enforce origin SAN/CN checking. |
tls_verify.allow_self_signed_certs | Boolean | Whether to allow self-signed certificates. Defaults to false . |
tls_verify.pinned_certs | String[] | An array of SHA256 hashes of pinned certificates. |
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.js2module.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
.staticAssets
The
staticAssets
config is an array of objects determining how Edgio handles static assets in your app configured with the following properties:Property | Type | Description |
---|---|---|
permanent | Boolean | Set to true if the file has a hash in path so that it can be considered unique across deployments. |
glob | String[] | A list of glob patterns that match or omit files to be included. |
serverless
The
serverless
config Object includes the following properties:Property | Type | Description |
---|---|---|
includeNodeModules | Boolean | If true , the packages listed in the dependencies property of package.json will be included in the build that is deployed to Edgio. |
include | String[] | A list of glob patterns that match or omit files to be included in the serverless bundle. Example: lang/**/* |
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 files3 '!(**/secrets/**/*)', // except everything in the secrets directory4];
Example edgio.config.js
See the full API specification for the edgio.config.js file here.
JavaScript
1// This file was automatically added by edgio init.2// You should commit this file to source control.3// Learn more about this file at https://docs.edg.io/guides/performance/cdn_as_code/edgio_config4module.exports = {5 // The name of the site in Edgio to which this app should be deployed.6 // name: 'my-site-name',78 // The name of the team in Edgio to which this app should be deployed.9 // team: 'my-team-name',1011 // Overrides the default path to the routes file. The path should be relative to the root of your app.12 // routes: 'routes.js',1314 origins: [15 {16 // The name of the backend origin17 name: 'origin',1819 // Use the following to override the host header sent from the browser when connecting to the origin20 override_host_header: 'origin.my-site.com',2122 // The list of origin hosts to which to connect23 hosts: [24 {25 // The domain name or IP address of the origin server26 location: 'origin.my-site.com',27 },28 ],2930 tls_verify: {31 use_sni: true,32 sni_hint_and_strict_san_check: 'origin.my-site.com',33 },3435 // Uncomment the following to configure a shield36 // shields: { us_east: 'DCD' },37 },38 ],3940 // Uncomment the following to specify environment specific configs41 // environments: {42 // production: {43 // hostnames: [{ hostname: 'www.mysite.com' }],44 // },45 // staging: {46 // hostnames: [{ hostname: 'staging.mysite.com' }],47 // origins: [48 // {49 // name: 'origin',50 // hosts: [{ location: 'staging-origin.mysite.com' }],51 // override_host_header: 'staging-origin.mysite.com',52 // tls_verify: {53 // use_sni: true,54 // sni_hint_and_strict_san_check: 'staging-origin.mysite.com',55 // },56 // shields: { us_east: 'DCD' },57 // },58 // ],59 // },60 // },6162 // Options for hosting serverless functions on Edgio63 // serverless: {64 // // Set to true to include all packages listed in the dependencies property of package.json when deploying to Edgio.65 // // This option generally isn't needed as Edgio automatically includes all modules imported by your code in the bundle that66 // // is uploaded during deployment67 // includeNodeModules: true,68 //69 // // Include additional paths that are dynamically loaded by your app at runtime here when building the serverless bundle.70 // include: ['views/**/*'],71 // },7273 // The maximum number of URLs that will be concurrently prerendered during deployment when static prerendering is enabled.74 // Defaults to 200, which is the maximum allowed value.75 // prerenderConcurrency: 200,7677 // A list of glob patterns identifying which source files should be uploaded when running edgio deploy --includeSources.78 // This option is primarily used to share source code with Edgio support personnel for the purpose of debugging. If omitted,79 // edgio deploy --includeSources will result in all files which are not gitignored being uploaded to Edgio.80 //81 // sources : [82 // '**/*', // include all files83 // '!(**/secrets/**/*)', // except everything in the secrets directory84 // ],85};