Welcome! Log In Create A New Profile

Advanced

how to redirect 302 in code?

August 25, 2009 09:04AM
the following code does not work as i expected in nginx-0.8.6,who can tell me why? thx

location = ngx_palloc(r->pool, strlen(url));
...
r->headers_out.location = ngx_palloc(r->pool, sizeof(ngx_table_elt_t));
...
ngx_copy(location, url, strlen(url));
r->headers_out.location->value.data = location;
r->headers_out.location->value.len = strlen(url);
r->headers_out.content_length_n = 0;
r->header_only = 1;
r->keepalive = 0;
return NGX_HTTP_MOVED_TEMPORARILY ;

the server returns the message as the following:
HTTP/1.1 302 Moved Temporarily
Server: nginx/0.8.6
Date: Tue, 25 Aug 2009 12:58:43 GMT
Content-Type: text/html
Content-Length: 160
Connection: close
Cache-Control: no-cache

no location here?why



Edited 1 time(s). Last edit at 08/25/2009 09:09AM by wangbin579.
Subject Author Posted

how to redirect 302 in code?

wangbin579 August 25, 2009 09:04AM

Re: how to redirect 302 in code?

Kirill A. Korinskiy August 25, 2009 09:37AM

Re: how to redirect 302 in code?

wangbin579 August 25, 2009 09:49PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 61
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 185 on January 31, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready