Select to view content in your preferred language

Esri Cross domain proxy for node.js

3817
2
08-25-2014 06:23 AM
maximcouton
Deactivated User

Hi,

 

Is there any esri cross domain proxy running on node.js ?

 

Thanks

0 Kudos
2 Replies
ReneRubalcava
Honored Contributor

There is an issue open for this on the esri/resource-proxy page, but no updates in a while on it.

node.js proxy page · Issue #63 · Esri/resource-proxy · GitHub

You could try and roll your own using express. It's not too difficult. I have one you could probably tweak, but it does not handle tokens.


proxy = new httpProxy.RoutingProxy();


// My attempt to use node http-proxy, may or may not work
// Seems to work when trying to proxy to a web site and AGS URLs, so ok
app.all('/proxy', function (req, res) {
    var buffer,
    url_,
    _query,
    _query_url,
    full_url,
    clean_url;


    /*
    * Apparently need this buffer because
    * express turns a POST body response
    * into an object.
    **/
    buffer = httpProxy.buffer(req);
    url_ = req.url.split('?')[1];
    _query = req.url.split('?')[2];
    _query_url = '';
    if (typeof _query !== 'undefined') {
        _query_url = '?' + _query;
    }
    full_url = url_ + _query_url;
    req.url = full_url;
    clean_url = url.parse(url_);


    proxy.proxyRequest(req, res, {
        host: clean_url.host,
        port: 80,
        buffer: buffer
    });


});

0 Kudos
maximcouton
Deactivated User

Hi Sir ,

    Is the issue also concerning the REST interface of ESRI ?  I mean  when I navigate to my ressource

I can use a form to make Query, addFeature, ....

0 Kudos