File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff 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 ( {
You can’t perform that action at this time.
0 commit comments