Merge pull request #7303 from strapi/minor/addKoaProxyConf

Add conf proxy koa variable
This commit is contained in:
Alexandre BODIN 2020-08-03 18:12:46 +02:00 committed by GitHub
commit 3fbd684981
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

View File

@ -174,7 +174,8 @@ module.exports = ({ env }) => ({
| `host` | Host name | string | `localhost` |
| `port` | Port on which the server should be running. | integer | `1337` |
| `emitErrors` | Enable errors to be emitted to `koa` when they happen in order to attach custom logic or use error reporting services. | boolean | `false` |
| `url` | Public url of the server. Required for many different features (ex: reset password, third login providers etc.). Also enables proxy support such as Apache or Nginx, example: `https://mywebsite.com/api`. The url can be relative, if so, it is used with `http://${host}:${port}` as the base url. An absolute url is however **recommended** | string | `''` |
| `url` | Public url of the server. Required for many different features (ex: reset password, third login providers etc.). Also enables proxy support such as Apache or Nginx, example: `https://mywebsite.com/api`. The url can be relative, if so, it is used with `http://${host}:${port}` as the base url. An absolute url is however **recommended**.| string | `''` |
|`proxy`| Set the koa variable `app.proxy`. When `true`, proxy header fields will be trusted. |boolean|`false`|
| `cron` | Cron configuration (powered by [`node-schedule`](https://github.com/node-schedule/node-schedule)) | Object | |
| `cron.enabled` | Enable or disable CRON tasks to schedule jobs at specific dates. | boolean | `false` |
| `admin` | Admin panel configuration | Object | |

View File

@ -57,6 +57,8 @@ class Strapi {
this.admin = {};
this.plugins = {};
this.config = loadConfiguration(this.dir, opts);
this.app.proxy = this.config.get('server.proxy');
this.isLoaded = false;
// internal services.

View File

@ -37,6 +37,7 @@ const defaultConfig = {
server: {
host: process.env.HOST || os.hostname() || 'localhost',
port: process.env.PORT || 1337,
proxy: false,
cron: { enabled: false },
admin: { autoOpen: false },
},