Fix 404 in sdc-FE calls to workflow

Fixes webpack workflow proxy configuration.
Fixes FE proxy while rewriting URLs to workflow plugin.
Fixes compilation problems to run locally the catalog-ui.

Change-Id: I89f3f46bd8ce0159713b1d0d957a2e75f8a3d062
Issue-ID: SDC-2943
Signed-off-by: andre.schmid <andre.schmid@est.tech>
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/FeProxyServlet.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/FeProxyServlet.java
index 3ea660a..8f76cb9 100644
--- a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/FeProxyServlet.java
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/FeProxyServlet.java
@@ -46,7 +46,7 @@
 
 public class FeProxyServlet extends SSLProxyServlet {
 	private static final long serialVersionUID = 1L;
-	private static final String URL = "%s://%s%s";
+	private static final String URL = "%s://%s%s%s";
 	private static final String MS_URL = "%s://%s:%s";
 	private static final String ONBOARDING_CONTEXT = "/onboarding-api";
 	private static final String DCAED_CONTEXT = "/dcae-api";
@@ -134,6 +134,7 @@
 		String protocol;
 		String host;
 		String port;
+		String path = "";
 		if (uri.contains(ONBOARDING_CONTEXT)){
 			uri = uri.replace(SDC1_FE_PROXY+ONBOARDING_CONTEXT,ONBOARDING_CONTEXT);
 			protocol = config.getOnboarding().getProtocolBe();
@@ -160,6 +161,7 @@
 			java.net.URL workflowURL = new URL(workflowPluginURL);
 			protocol = workflowURL.getProtocol();
 			host = workflowURL.getHost();
+			path = workflowURL.getPath();
 			port = String.valueOf(workflowURL.getPort());
 		}
 		else{
@@ -173,15 +175,15 @@
 			}
 		}	
 
-		String authority = getAuthority(host, port);
-		String modifiedUrl = String.format(URL,protocol,authority,uri);
-		if( !StringUtils.isEmpty(queryString)){
+		final String authority = getAuthority(host, port);
+		String modifiedUrl = String.format(URL, protocol, authority, path, uri);
+		if (StringUtils.isNotEmpty(queryString)) {
 			modifiedUrl += "?" + queryString;
 		}
 		 
-		return  modifiedUrl;
-
+		return modifiedUrl;
 	}
+
 	@VisibleForTesting
 	String redirectMsRequestToMservice(HttpServletRequest request, Configuration config) throws MalformedURLException {
 
@@ -299,11 +301,10 @@
 
 	private String getAuthority(String host, String port) {
 		String authority;
-		if (port==null){
-			authority=host;
-		}
-		else{
-			authority=host+":"+port;
+		if (port == null) {
+			authority = host;
+		} else {
+			authority = host + ":" + port;
 		}
 		return authority;
 	}
diff --git a/catalog-ui/webpack.server.js b/catalog-ui/webpack.server.js
index 0d43fa1..ab86785 100644
--- a/catalog-ui/webpack.server.js
+++ b/catalog-ui/webpack.server.js
@@ -5,16 +5,8 @@
 const fePort = 8181;
 const feHost = "localhost";
 const protocol="http";
-const isDirectToFE = false;
+const isDirectToFE = true;
 
-/*
-For kubernetes
-const fePort = 30207;
-const wfPort = 30256;
-const feHost = "kubernetes_master";
-const protocol="https";
-const isDirectToFE = true;// whether to proxy to the k8s proxy or to the BE
-*/
 const portalCookieValue = "randomValue"; //for dev solely, in production - the webseal would add the cookie by itself.
 
 module.exports = function (env) {
@@ -56,15 +48,11 @@
                 secure: false,
                 logLevel: 'debug'
             }    
-            if (isDirectToFE) {
-                feProxyOptions.pathRewrite= {
-                    '^/sdc1/feProxy/rest' : '/sdc1/feProxy/rest'
-                }
-            } else {
-                feProxyOptions.pathRewrite= {
-                    '^/sdc1/feProxy/rest' : '/sdc2/rest'
-                }
-            }    
+            if (!isDirectToFE) {
+              feProxyOptions.pathRewrite= {
+                '^/sdc1/feProxy/rest' : '/sdc2/rest'
+              }
+            }
             middlewares.push(
                 proxy(['/sdc1/feProxy/rest'], feProxyOptions));
 
@@ -106,14 +94,11 @@
 
             // Redirect workflow urls to feHost
             middlewares.push(
-                proxy(['/sdc1/feProxy/wf', '/wf'], {
-                    target: protocol + '://' + feHost + ':' + wfPort,
+                proxy(['/wf', '/sdc1/feProxy/wf'], {
+                    target: protocol + '://' + feHost + ':' + fePort,
                     changeOrigin: true,
                     logLevel: 'debug',
                     secure: false,
-                    pathRewrite: {
-                        '^/sdc1/feProxy' : ''
-                    },
                     onProxyRes: (proxyRes, req, res) => {
                         let setCookie = proxyRes.headers['set-cookie'];
                         if (setCookie) {