Vasisualiy
Vasisualiy

Reputation: 750

Nginx module redirect

Good day

I am writing a module for Nginx, that should redirect user to certain (local) URLs, if several conditions apply - something like ngx_http_rewrite_module (Though I couldn't find redirection code in that module).

My code successfully runs on required events, but I am unable to redirect user to another page.

I've tried ngx_http_internal_redirect, but it didn't work:

static ngx_str_t  ngx_redirect_script = ngx_string("/dst.php");
return ngx_http_internal_redirect(r, &ngx_redirect_script , &r->args);

Perhaps somebody knows how to do that? Thank you!

Upvotes: 2

Views: 803

Answers (1)

Vasisualiy
Vasisualiy

Reputation: 750

Interesting, this worked:

ngx_http_internal_redirect(r, &ngx_redirect_script , &r->args);
return NGX_HTTP_OK;

Upvotes: 1

Related Questions