Writing a module to use with http_proxy

regall nginx-forum at nginx.us
Thu Jul 21 15:14:34 UTC 2011

I've tried to start and I faced a 'segmentation fault' error. I tried to
add handler to NGX_HTTP_ACCESS_PHASE and that causes segmentation fault.
Here's the code. Init function is called from merge_loc_conf

// auth check handler
static ngx_int_t ngx_http_zd_aws_proxy_check(ngx_http_request_t *r)

// Config initializer, adds core handler to check auth
static ngx_int_t ngx_http_zd_aws_proxy_init(ngx_conf_t *cf)

    ngx_http_handler_pt        *h;
    ngx_http_core_main_conf_t  *cmcf;

    cmcf = ngx_http_conf_get_module_main_conf(cf,

    h = ngx_array_push(&cmcf->phases[NGX_HTTP_ACCESS_PHASE].handlers);
    if (h == NULL) {
        return NGX_ERROR;

    *h = ngx_http_zd_aws_proxy_check;

    return NGX_OK;

Any thoughts on that ?

Thank you.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,212741,212762#msg-212762

More information about the nginx mailing list