aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/proxy/ngx_http_proxy_header.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/modules/proxy/ngx_http_proxy_header.c')
-rw-r--r--src/http/modules/proxy/ngx_http_proxy_header.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/http/modules/proxy/ngx_http_proxy_header.c b/src/http/modules/proxy/ngx_http_proxy_header.c
index 8c24a065e..cb13034f7 100644
--- a/src/http/modules/proxy/ngx_http_proxy_header.c
+++ b/src/http/modules/proxy/ngx_http_proxy_header.c
@@ -20,6 +20,8 @@ int ngx_http_proxy_copy_header(ngx_http_proxy_ctx_t *p,
h = headers_in->headers.elts;
for (i = 0; i < headers_in->headers.nelts; i++) {
+ /* ignore some headers */
+
if (&h[i] == headers_in->connection) {
continue;
}
@@ -51,12 +53,18 @@ int ngx_http_proxy_copy_header(ngx_http_proxy_ctx_t *p,
}
}
+
+ /* "Content-Type" is handled specially */
+
if (&h[i] == headers_in->content_type) {
r->headers_out.content_type = &h[i];
r->headers_out.content_type->key.len = 0;
continue;
}
+
+ /* copy some header pointers and set up r->headers_out */
+
if (!(ho = ngx_http_add_header(&r->headers_out, ngx_http_headers_out)))
{
return NGX_ERROR;
@@ -64,9 +72,30 @@ int ngx_http_proxy_copy_header(ngx_http_proxy_ctx_t *p,
*ho = h[i];
+ if (&h[i] == headers_in->expires) {
+ r->headers_out.expires = ho;
+ continue;
+ }
+
+ if (&h[i] == headers_in->cache_control) {
+ r->headers_out.cache_control = ho;
+ continue;
+ }
+
+ if (&h[i] == headers_in->etag) {
+ r->headers_out.etag = ho;
+ continue;
+ }
+
+ if (&h[i] == headers_in->last_modified) {
+ r->headers_out.last_modified = ho;
+ /* TODO: update r->headers_out.last_modified_time */
+ continue;
+ }
+
/*
- * ngx_http_header_filter() does not handle specially
- * the following headers if they are set:
+ * ngx_http_header_filter() passes the following headers as is
+ * and does not handle them specially if they are set:
* r->headers_out.server,
* r->headers_out.date,
* r->headers_out.content_length