Disable proxying in api designer


#1

I’m currently running my api on my localhost.
When I want to test out my API from the API Designer it attempts to proxy it using http://www.apihub.com/raml-proxy, which obviously can’t contact my localhost.

The API Notebook allows us to disable proxying. Is there a similar setting for API Designer?

thanks,

Patrick


#2

Hi @pradtke,

To disable proxy you need to reset RAML.Settings.proxy property by either deleting (delete RAML.Settings.proxy) it or assigning falsy value to it (RAML.Settings.proxy = false). The solution isn’t persistent and if you want it to be, please let me know and I’ll be happy to help. Make sure CORS is enabled on your side otherwise designer won’t be able to make any requests.


#3

@pavel_strashkin

Thanks Pavel. I attached a JavaScript debugger and was able to change the setting. Oddly the first time I do a GET the cursor just spins, however all subsequent GETs go through to my local server.

I think it makes sense to add a persistent option. Early on in our API brainstorming/development our developers just run the API locally.


#4

To make it persistent you need to add the following block of code at the end of body tag:

<script>
  angular.module('ramlEditorApp')
    .run(function () {
      // Disable proxying HTTP requests
      RAML.Settings.proxy = false;
    })
  ;
</script>

Mocking Service Beta Released
#5

Hi @pradtke,

how do one disable proxying on the api-notebook?

Thanks in advance!

Cheers
Igor


#6

@igor_kosta

I believe I disabled it in my local setup with this patch

--- a/app/scripts/app.js
+++ b/app/scripts/app.js
@@ -25,6 +25,7 @@ angular.module('ramlEditorApp',
 )
   .run(function ($window) {
     // Adding proxy settings for api console
-    $window.RAML.Settings.proxy = '/proxy/';
+         //    $window.RAML.Settings.proxy = '/proxy/';
+    $window.RAML.Settings.proxy = false;
   })
 ; 

#7

Hi @pradtke,

thank you very much for the answer. Unfortunately I only could find an app.js file under: public/scripts/views/app.js
but there is no proxy setting in this file.

Cheers
Igor


#8

thank you! worked perfectly.
I’ve edited file located here: /usr/local/lib/node_modules/api-designer/dist/index.html