how to redirect 302 in code?

wangbin579 nginx-forum at nginx.us
Tue Aug 25 17:04:09 MSD 2009


the following code does not work 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 ;

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






More information about the nginx mailing list