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:Property | Type | Description |
---|---|---|
domainOrIp | String | (Required) The domain or ip address for the backend site or API. |
hostHeader | String | A 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. |
disableCheckCert | Boolean | A 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. |
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. |
Custom Ports
For security reasons, you must use the compute function to proxy requests to a custom port (i.e., a port other than 443 or 80).
The following sample code demonstrates how to proxy to a backend (i.e.,
commerce
) whose port
property has been set to a custom port:JavaScript./routes.js
1// proxy to a custom port through Serverless Compute2.match(3 '/:path*',4 ({ proxy, compute }) => {5 compute(async (req) => {6 await proxy('commerce');7 });8 }9)
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
.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 files3 '!(**/secrets/**/*)', // except everything in the secrets directory4]
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 server7 domainOrIp: "example.com",89 // When provided, the following value will be sent as the host header10 // when connecting to the origin. If omitted, the host header from11 // the browser will be forwarded to the origin.12 hostHeader: "example.com",1314 // Uncomment the following line if TLS is not set up properly on the15 // origin domain and you want to ignore TLS errors16 disableCheckCert: true,1718 // Overrides the default ports (80 for http and 443 for https) and19 // instead use a specific port when connecting to the origin20 port: 1337,21 },22 },2324 // The name of the site in Edgio to which this app should be deployed.25 name: "example.com",2627 // The name of the team in Edgio to which this app should be deployed.28 team: 'my-team-name',2930 // Overrides the default path to the routes file. The path should be relative31 // to the root of your app.32 routes: 'routes.js',3334 // The maximum number of URLs that will be concurrently prendered during35 // deployment when static prerendering is enabled. Defaults to 200, which is36 // the maximum allowed value.37 prerenderConcurrency: 200,3839 // A list of glob patterns identifying which source files should be uploaded40 // when running edgio deploy --includeSources. This option is primarily used41 // to share source code with Edgio support personnel for the purpose of42 // debugging. If omitted, edgio deploy --includeSources will result in all43 // files which are not gitignored being uploaded to Edgio.44 //45 sources : [46 '**/*', // include all files47 '!(**/secrets/**/*)', // except everything in the secrets directory48 ],4950 // Set to true to include all packages listed in the dependencies property51 // of package.json when deploying to Edgio. This option generally isn't52 // needed as Edgio automatically includes all modules imported by your53 // code in the bundle that is uploaded during deployment54 //55 includeNodeModules: true,56};