Welcome! Log In Create A New Profile

Advanced

Re: Using body content to generate a correct response

Maxim Dounin
January 09, 2014 10:56AM
Hello!

On Tue, Jan 07, 2014 at 03:20:41PM -0200, Guido Accardo wrote:

> Hi everyone,
>
> I'm using Nginx to serve applications of Real Time Bidding listening in
> different machines inside of my network. Each one of these applications is
> handling request from only one exchange and I'm successfully proxying the
> content to the correct applications by using upstreams.
>
> One thing that I'm doing when I need to do some modifications in one o more
> of these applications is use "return 204" (for RTB system using OpenRTB
> protocl, HTTP 204 means NO BID) to not forward content. This was working
> great until now that my employer has decided to include another exchange,
> in consequence, another application. The new exchange is not OpenRTB based,
> it uses another protocol to answer, and of course no bid response is
> different too.
>
> In order to correctly answer with no bid I have to parse XML content which
> is inside of the request sent by the exchange. This is the form of the
> response I have to send:
>
>
> <bidResp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="urn:yahoo:amp:3pi:bidResp"
> xsi:schemaLocation="urn:yahoo:amp:3pi:bidResp BidResponse.xsd"
> version="6.0">
> <bidResEnv signature="00C745CC3125610C5C1A30EBC9388FC7F8FE1F21"
> signType="SHA-1" token="1218078703"/>
>
> <bidResponseSet numResp="1">
> <bidResponse>
> <oppId>da21129c-aca1-11e2-8c8c-2be3e1d9a996</oppId>
> <advId>502863</advId>
> <buyerLine>4372011</buyerLine>
> <noBid/>
> </bidResponse>
> </bidResponseSet>
>
>
> OppId, advId, buyerLine, bidResEnv signature are items that comes with the
> request.
>
> As you can see I have 2 challenges here:
>
> * Parse XML body content with Nginx
> * Manipulate It to generate the correct answer
>
> Do I need to develop a Nginx plugin or there is a simpler way to parse the
> body content and use it to answer?
>
> I know that Nginx can use headers from the request in the response, so I
> presume that something with the body could also done.

Trivial solution would be to use embedded perl to read a request
body and return appropriate answer, see here:

http://nginx.org/en/docs/http/ngx_http_perl_module.html

It should be also possible to do this using 3rd party Lua module.

--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Using body content to generate a correct response

Guido Accardo 1219 January 07, 2014 12:22PM

Re: Using body content to generate a correct response

Maxim Dounin 409 January 09, 2014 10:56AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 183
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready