Skip to content

Commit 7f71e91

Browse files
committed
Fixes #15 with a warning check
1 parent b4001ec commit 7f71e91

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

tasks/connect_proxy.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ module.exports = function(grunt) {
1616
var httpProxy = require('http-proxy');
1717
var proxyOption;
1818
var proxyOptions = [];
19+
var validateProxyConfig = function(proxyOption) {
20+
if (_.isUndefined(proxyOption.host) || _.isUndefined(proxyOption.context)) {
21+
grunt.log.error('Proxy missing host or context configuration');
22+
return false;
23+
}
24+
if (proxyOption.https && proxyOption.port === 80) {
25+
grunt.log.warn('Proxy for ' + proxyOption.context + ' is using https on port 80. Are you sure this is correct?');
26+
}
27+
return true;
28+
};
29+
1930
utils.reset();
2031
utils.log = grunt.log;
2132
if (config) {
@@ -35,9 +46,7 @@ module.exports = function(grunt) {
3546
rejectUnauthorized: false,
3647
rules: []
3748
});
38-
if (_.isUndefined(proxyOption.host) || _.isUndefined(proxyOption.context)) {
39-
grunt.log.error('Proxy missing host or context configuration');
40-
} else {
49+
if (validateProxyConfig(proxyOption)) {
4150
proxyOption.rules = utils.processRewrites(proxyOption.rewrite);
4251
utils.registerProxy({
4352
server: new httpProxy.HttpProxy({

0 commit comments

Comments
 (0)