UNPKG

517 BJavaScriptView Raw
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
5var uuid = require('uuid');
6
7module.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}