Skip to content

Commit 334d933

Browse files
committed
Fix body for nginx on robot txt
1 parent d62f3e6 commit 334d933

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/ngx_http_redirectionio_module.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,10 @@ static ngx_int_t ngx_http_redirectionio_redirect_handler(ngx_http_request_t *r)
371371

372372
r->headers_out.status = redirect_status_code;
373373

374-
return r->headers_out.status;
374+
// Force special response for 2XX request
375+
ngx_http_finalize_request(r, ngx_http_special_response_handler(r, r->headers_out.status));
376+
377+
return NGX_DONE;
375378
}
376379

377380
static ngx_int_t ngx_http_redirectionio_log_handler(ngx_http_request_t *r) {

src/ngx_http_redirectionio_module_filter.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,14 @@ static ngx_int_t ngx_http_redirectionio_buffer_read(ngx_buf_t *buffer, struct RE
463463

464464
bsize = ngx_buf_size(buffer);
465465

466-
if (bsize <= 0) {
466+
if (bsize == 0) {
467+
output->data = NULL;
468+
output->len = 0;
469+
470+
return NGX_OK;
471+
}
472+
473+
if (bsize < 0) {
467474
return NGX_DONE;
468475
}
469476

0 commit comments

Comments
 (0)