Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add conf proxy koa variable #7303

Merged
merged 1 commit into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/v3.x/concepts/configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | |
Expand Down
2 changes: 2 additions & 0 deletions packages/strapi/lib/Strapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions packages/strapi/lib/core/app-configuration/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
},
Expand Down