0

I created simple proxy server in node JS, it looks like this:

var httpProxy = require('http-proxy');

var proxy = httpProxy.createProxyServer({});

//proxy config
app.all('/proxy/*', function (request, response) {
    "use strict";
    return proxy.web(request, response, {
    target: 'http://localhost:1234/'
    });
});

The problem I'm having is that it creates proxy URL from lets say sample request:

$http.get('/proxy/example')
        .success( function(res) {
          $scope.quote = res;
          alert($scope.quote);
          })

which looks like this:

localhost:1234/proxy/example

but I want it to create URL lookin like this:

localhost:1234/example

What am I doing wrong?

PS Sorry if question is not formatted properly or too easy - it's my first ask on stack

1 Answer 1

1

Don't do /proxy/example instead write only example

   $http.get('example')
    .success( function(res) {
      $scope.quote = res;
      alert($scope.quote);
      })
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.