1 | // Copyright Michael Rhodes. 2017,2018. All Rights Reserved.
|
2 | // This file is licensed under the MIT License.
|
3 | // License text available at https://opensource.org/licenses/MIT
|
4 |
|
5 | var uuid = require('uuid');
|
6 |
|
7 | module.exports.fixIfBehindProxy = function fixIfBehindProxy(url) {
|
8 | if (process.env.BEHIND_PROXY === "true") {
|
9 | var rx = new RegExp('^' + config.publicHost);
|
10 | if (url.match(rx)) {
|
11 | url = url.replace(config.publicHost, 'http://localhost:' + config.port);
|
12 | debug('bypass proxy ' + url);
|
13 | }
|
14 | }
|
15 | return url;
|
16 | }
|