Get current location where the module's working

2015-08-19 Thread Hung Nguyen
Hello, This seems to be a strange question, but I am writing a small module that need to get current location where it’s working, example: location /special { my_module; enable on; } Inside my_module, I want to be able to get location —> will return “/special”. Can we do that

Re: How to get Original response before gzip or another module filter rewrite response

2015-09-07 Thread Hung Nguyen
Hello, I don’t know which context you are trying to do, but in order to write a chain buffer (this’s what contain nginx’s response) to file, you can use ngx_write_chain_to_file or ngx_write_chain_to_temp_file function. Many nginx modules already use these function, take a look at ngx_http_prox

Some times header cannot be sent due too high traffic

2015-09-24 Thread Hung Nguyen
Hello, In my module I do something like this: nlog->action = "sending file to client"; r->headers_out.status = NGX_HTTP_OK; r->headers_out.content_length_n = bucket->content_length; r->headers_out.last_modified_time = of.mtime; r->headers_out.content_type.l

Re: Processing responses of unbounded sizes from upstream servers

2015-11-02 Thread Hung Nguyen
Hello Maxim, +1 At least there’s someone understand community’s need. Most of open source nginx module was built by reading nginx source code and other open source module. None of those was from Nginx document which should be available for open source developer to use and understand since Nginx

Re: upstream/302

2016-05-17 Thread Hung Nguyen
Hello, I do not not think nginx has this feature, but we can do it with lua module, at it’s exactly what I did, you can find it here: https://github.com/whatvn/nginx_redirect_balancer It works with help of following awesome module by agentzh: lua-nginx-module and lua-updstream-module - Hun

Re: C++ module

2016-06-15 Thread Hung Nguyen
Hello, Nginx comes with a demo module written in C++ in source code Sent from my iPhone > On Jun 16, 2016, at 3:49 AM, Piotr Sikora wrote: > > Hey Raj, > it is, take a look at ngx_brotli [1] and ngx_pagespeed [2]. > > [1] https://github.com/google/ngx_brotli > [2] https://github.com/pagespee

Re: C++ module

2016-06-15 Thread Hung Nguyen
tring within say the module context, I see a segmentation fault. I assume it's because of the Nginx pool mechanism? On 16 Jun 2016, at 02:31, Hung Nguyen wrote: Hello, Nginx comes with a demo module written in C++ in source code Sent from my iPhone On Jun 16, 2016, at 3:49 AM, Piotr Sik

Re: nginx development guide

2017-02-13 Thread Hung Nguyen
Many thanks on taking steps for this guide. I’ve been waiting for it for so long. Good job! On 2/13/17, 4:38 PM, "nginx-devel on behalf of Vladimir Homutov" wrote: >Hello all! > >We are glad to share with first results of our ongoing efforts to create >documentation for nginx developers

[module] Tracking connection status from accepted to closed

2017-10-28 Thread Hung Nguyen
Hello, I am writing a HTTP core module that track http connection to know when it’s accepted and closed within nginx. What I am doing is register my module at PREACCESS_PHASE, and then adding a clean up callback to know when the connection closed (from nginx side). The problem is from my modu

Re: header already sent

2018-07-06 Thread Hung Nguyen
Hello, I didnt read your code carefully but in case you want to deny request, just return NGX_HTTP_FORBIDDEN, don’t need to send any http header, nginx will take care the rest. If you want to handle 403 error by a custom 403 page, use error handler in nginx configuration file instead. -- Hư

Re: post handler json data

2019-01-17 Thread Hung Nguyen
Hello, With this type of purpose I personally think you should take a look at njs instead of writing nginx module. Json can be done easier with JS -- Hưng > On Jan 17, 2019, at 20:57, Manickam wrote: > > Hi, > > I am new to Nginx development and looking for simple module which just dumps >

Re: [Module development] Any good idea to hook response from proxy

2019-02-18 Thread Hung Nguyen
As my understanding all you need is doing a body filter on backend_upstream response and send a set request to memcache with value is response itself. To determine whether response is from memcache or from backend, before proxy pass request to backend you can set some customize header like x-up

Re: nginx - get value of the header - x_forwarded_for in Nginx module (Naxsi)

2019-12-28 Thread Hung Nguyen
Hello, I suggest you to read nginx development guide which is available on nginx.org. About getting x forward for headers, if you take a look at some built in module there’s already exist implementation which takes the headers and returns an array. -- Hưng > On Dec 29, 2019, at 03:49, Rober

Re: (draft) Privacy by design - offer more convenient way to anonymize IPs in access log by default

2020-09-21 Thread Hung Nguyen
Hi Christian, In my opinion your use case (GDPR) is not widely used, since Nginx offers developer number of ways to change nginx behaviour and add more feature other than default, you should consider to write your own module to archive what you want -- Hưng > On Sep 22, 2020, at 13:31, Christ