Skip to content

Commit 8e67673

Browse files
authored
Merge pull request #87 from TerriaJS/proxyAuthInMainConfig
Allow specifying proxyAuth in main config file
2 parents d6b3b17 + 99e26c8 commit 8e67673

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 2.7.3
2+
3+
* Proxy authentication can now optionally be specified with the `proxyAuth` key in the `--config-file`, as an alternative to `--proxy-auth`.
4+
15
### 2.7.2
26

37
* When using `--proxy-auth` to automatically supply HTTP basic authentication credentials, and the remote server returns 403 (Forbidden), we now retry the request without the credentials. This will usually result in the server responding with a 401 (Unauthorized), causing the user's browser to prompt for credentials. This is useful when some of the resources on the server are not available with the automatic credentials but will work if more powerful credentials are supplied.

lib/options.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ options.init = function(quiet) {
107107
this.settings = getConfig(this.configFile, 'config', 'ALL proxy requests will be accepted.', quiet);
108108
this.proxyAuthFile = getConfigFile(argv.proxyAuth, 'proxyauth.json');
109109
this.proxyAuth = getConfig(this.proxyAuthFile, 'proxyAuth', 'Proxying to servers that require authentication will fail', quiet);
110+
111+
if (!this.proxyAuth || Object.keys(this.proxyAuth).length === 0) {
112+
this.proxyAuth = this.settings.proxyAuth || {};
113+
}
114+
110115
this.port = argv.port || this.settings.port || 3001;
111116
this.wwwroot = argv._.length > 0 ? argv._[0] : process.cwd() + '/wwwroot';
112117
this.configDir = argv.configFile ? path.dirname (argv.configFile) : '.';

0 commit comments

Comments
 (0)