librelist archives

« back to archive

reverse proxy type API writing

reverse proxy type API writing

From:
Oğuz Yarımtepe
Date:
2015-07-23 @ 11:33
Hi,

I am working on a middleware project and some functions will be just
forwarding the request to another API without changing it and returning
back the result. I am wondering whether there is a quick and easy way of
implementing this issue in falcon.

Regards.

-- 
Oğuz Yarımtepe
http://about.me/oguzy

Re: [falcon] reverse proxy type API writing

From:
Andrew Stuart
Date:
2015-07-23 @ 12:37
Doing this can be potentially a big job depending on what you are trying 
to achieve.  At its simplest you can just pick up the URL, the method, the
parameters and POST data and then use Python requests to send exactly the 
same request to your back end API.


On 23 Jul 2015, at 9:33 pm, Oğuz Yarımtepe <oguzyarimtepe@gmail.com> wrote:

Hi,

I am working on a middleware project and some functions will be just 
forwarding the request to another API without changing it and returning 
back the result. I am wondering whether there is a quick and easy way of 
implementing this issue in falcon.

Regards.

-- 
Oğuz Yarımtepe
http://about.me/oguzy

Re: [falcon] reverse proxy type API writing

From:
Adriano Almeida
Date:
2015-07-23 @ 13:05
I agree with Andrew.
If using Falcon it's not mandatory, you should use other software like
nginx...

The other option, it's to use a function that receives the: Request Object
- enough to get URL, POSTDATA and HEADERS - use Python's Library Requets -
and you fill the Response Object.






2015-07-23 14:37 GMT+02:00 Andrew Stuart <andrew.stuart@supercoders.com.au>:

> Doing this can be potentially a big job depending on what you are trying
> to achieve.  At its simplest you can just pick up the URL, the method, the
> parameters and POST data and then use Python requests to send exactly the
> same request to your back end API.
>
>
> On 23 Jul 2015, at 9:33 pm, Oğuz Yarımtepe <oguzyarimtepe@gmail.com>
> wrote:
>
> Hi,
>
> I am working on a middleware project and some functions will be just
> forwarding the request to another API without changing it and returning
> back the result. I am wondering whether there is a quick and easy way of
> implementing this issue in falcon.
>
> Regards.
>
> --
> Oğuz Yarımtepe
> http://about.me/oguzy
>
>


-- 
Adriano Almeida

Re: [falcon] reverse proxy type API writing

From:
Richard Olsson
Date:
2015-07-23 @ 13:16
Hi,

The Falcon documentation has an example of (among other things) how you 
could proxy some requests based on a prefix using a feature called sinks.
http://falcon.readthedocs.org/en/stable/user/quickstart.html#more-features

<http://falcon.readthedocs.org/en/stable/user/quickstart.html#more-features>

Cheers
/Richard


> On 23 jul 2015, at 13:33, Oğuz Yarımtepe <oguzyarimtepe@gmail.com> wrote:
> 
> Hi,
> 
> I am working on a middleware project and some functions will be just 
forwarding the request to another API without changing it and returning 
back the result. I am wondering whether there is a quick and easy way of 
implementing this issue in falcon.
> 
> Regards.
> 
> -- 
> Oğuz Yarımtepe
> http://about.me/oguzy <http://about.me/oguzy>

Re: [falcon] reverse proxy type API writing

From:
Andrew Stuart
Date:
2015-07-23 @ 13:23
If you want to look at how big the exercise can get I just finished a 
Falcon based authenticating proxy server for Mailman 3 which sits in front
of the Mailman 3 REST API and proxies requests to the back end API and 
implements JWT authentication and authorization.

It’s GPL so be mindful of that if you’re copying code.

https://gitlab.com/astuart/mailmania

The function that does the proxying is in def 
proxy_to_mailman(**request_handler_args):


https://gitlab.com/astuart/mailmania/blob/master/serve_spec_mailman_rest_api/operations_servers.py


On 23 Jul 2015, at 11:16 pm, Richard Olsson <r@richardolsson.se> wrote:

Hi,

The Falcon documentation has an example of (among other things) how you 
could proxy some requests based on a prefix using a feature called sinks.
http://falcon.readthedocs.org/en/stable/user/quickstart.html#more-features

Cheers
/Richard


> On 23 jul 2015, at 13:33, Oğuz Yarımtepe <oguzyarimtepe@gmail.com> wrote:
> 
> Hi,
> 
> I am working on a middleware project and some functions will be just 
forwarding the request to another API without changing it and returning 
back the result. I am wondering whether there is a quick and easy way of 
implementing this issue in falcon.
> 
> Regards.
> 
> -- 
> Oğuz Yarımtepe
> http://about.me/oguzy

Re: [falcon] reverse proxy type API writing

From:
Andrew Stuart
Date:
2015-07-23 @ 13:27
Another potentially good solution that I found yesterday is to use Kong 
which is a REST API proxy server written in Lua which integrates tightly 
with nginx.

http://getkong.org/

Re: [falcon] reverse proxy type API writing

From:
Oğuz Yarımtepe
Date:
2015-07-23 @ 13:33
Kong looks promising. Thank you.

On Thu, Jul 23, 2015 at 4:27 PM, Andrew Stuart <
andrew.stuart@supercoders.com.au> wrote:

> Another potentially good solution that I found yesterday is to use Kong
> which is a REST API proxy server written in Lua which integrates tightly
> with nginx.
>
> http://getkong.org/
>



-- 
Oğuz Yarımtepe
http://about.me/oguzy

Re: [falcon] reverse proxy type API writing

From:
Oğuz Yarımtepe
Date:
2015-07-23 @ 13:34
Falcon proxy property sounds as an alternative if i will not use nginx or
kong type proxy server. Thank you.

On Thu, Jul 23, 2015 at 4:16 PM, Richard Olsson <r@richardolsson.se> wrote:

> Hi,
>
> The Falcon documentation has an example of (among other things) how you
> could proxy some requests based on a prefix using a feature called sinks.
> http://falcon.readthedocs.org/en/stable/user/quickstart.html#more-features
>
> Cheers
> /Richard
>
>
> On 23 jul 2015, at 13:33, Oğuz Yarımtepe <oguzyarimtepe@gmail.com> wrote:
>
> Hi,
>
> I am working on a middleware project and some functions will be just
> forwarding the request to another API without changing it and returning
> back the result. I am wondering whether there is a quick and easy way of
> implementing this issue in falcon.
>
> Regards.
>
> --
> Oğuz Yarımtepe
> http://about.me/oguzy
>
>
>


-- 
Oğuz Yarımtepe
http://about.me/oguzy