Use proxy-addr for parsing x-forwarded-for
Closes #683 by providing functionality to trust proxies other than localhost.
This commit is contained in:
parent
9cffd7dde8
commit
76e0d1b7ec
7 changed files with 45 additions and 78 deletions
|
|
@ -1,10 +1,5 @@
|
|||
import clone from 'clone';
|
||||
|
||||
const DEFAULT_TRUSTED_PROXIES = Object.freeze([
|
||||
'127.0.0.1',
|
||||
'::1'
|
||||
]);
|
||||
|
||||
export default class WebConfiguration {
|
||||
constructor(config) {
|
||||
this.config = config;
|
||||
|
|
@ -15,7 +10,7 @@ export default class WebConfiguration {
|
|||
}
|
||||
|
||||
getTrustedProxies() {
|
||||
return DEFAULT_TRUSTED_PROXIES;
|
||||
return this.config.trustProxies;
|
||||
}
|
||||
|
||||
getCookieSecret() {
|
||||
|
|
@ -76,5 +71,7 @@ WebConfiguration.fromOldConfig = function (oldConfig) {
|
|||
|
||||
config.maxIndexEntries = oldConfig.get('http.index.max-entries');
|
||||
|
||||
config.trustProxies = oldConfig.get('http.trust-proxies');
|
||||
|
||||
return new WebConfiguration(config);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue