Revert "Revert "Merge pull request #293 from pgreyson/master""

This reverts commit 6deae1d3651995473ac2e7877d28f6ef7abd4e16.
diff --git a/web/restapi2.py b/web/restapi2.py
index ca6ad5c..c9952ac 100755
--- a/web/restapi2.py
+++ b/web/restapi2.py
@@ -53,15 +53,19 @@
 
   return response
 
-## PROXY API (allows development where the webui is served from someplace other than the ONOS_HOST)##
-#ONOS_HOST="http://gui3.onlab.us:8080"
-ONOS_HOST="http://localhost:8080" ;# for Amazon EC2
+## PROXY API (allows development where the webui is served from someplace other than the controller)##
+ONOS_GUI3_HOST="http://gui3.onlab.us:8080"
+ONOS_LOCAL_HOST="http://localhost:8080" ;# for Amazon EC2
 
 @app.route("/wm/core/topology/switches/all/json")
-@app.route("/proxy/wm/core/topology/switches/all/json")
 def switches():
+  if request.args.get('proxy') == None:
+    host = ONOS_LOCAL_HOST
+  else:
+    host = ONOS_GUI3_HOST
+
   try:
-    command = "curl -s %s/wm/core/topology/switches/all/json" % (ONOS_HOST)
+    command = "curl -s %s/wm/core/topology/switches/all/json" % (host)
     print command
     result = os.popen(command).read()
   except:
@@ -72,10 +76,14 @@
   return resp
 
 @app.route("/wm/core/topology/links/json")
-@app.route("/proxy/wm/core/topology/links/json")
 def links():
+  if request.args.get('proxy') == None:
+    host = ONOS_LOCAL_HOST
+  else:
+    host = ONOS_GUI3_HOST
+
   try:
-    command = "curl -s %s/wm/core/topology/links/json" % (ONOS_HOST)
+    command = "curl -s %s/wm/core/topology/links/json" % (host)
     print command
     result = os.popen(command).read()
   except:
@@ -86,10 +94,14 @@
   return resp
 
 @app.route("/wm/flow/getall/json")
-@app.route("/proxy/wm/flow/getall/json")
 def flows():
+  if request.args.get('proxy') == None:
+    host = ONOS_LOCAL_HOST
+  else:
+    host = ONOS_GUI3_HOST
+
   try:
-    command = "curl -s %s/wm/flow/getall/json" % (ONOS_HOST)
+    command = "curl -s %s/wm/flow/getall/json" % (host)
     print command
     result = os.popen(command).read()
   except:
@@ -100,10 +112,14 @@
   return resp
 
 @app.route("/wm/registry/controllers/json")
-@app.route("/proxy/wm/registry/controllers/json")
 def registry_controllers():
+  if request.args.get('proxy') == None:
+    host = ONOS_LOCAL_HOST
+  else:
+    host = ONOS_GUI3_HOST
+
   try:
-    command = "curl -s %s/wm/registry/controllers/json" % (ONOS_HOST)
+    command = "curl -s %s/wm/registry/controllers/json" % (host)
     print command
     result = os.popen(command).read()
   except:
@@ -114,10 +130,14 @@
   return resp
 
 @app.route("/wm/registry/switches/json")
-@app.route("/proxy/wm/registry/switches/json")
 def registry_switches():
+  if request.args.get('proxy') == None:
+    host = ONOS_LOCAL_HOST
+  else:
+    host = ONOS_GUI3_HOST
+
   try:
-    command = "curl -s %s/wm/registry/switches/json" % (ONOS_HOST)
+    command = "curl -s %s/wm/registry/switches/json" % (host)
     print command
     result = os.popen(command).read()
   except: