diff --git a/src/client.c b/src/client.c index e74b1c4..6c6678c 100644 --- a/src/client.c +++ b/src/client.c @@ -13,9 +13,7 @@ int server_keep_alive = 1; -char *client_addr_str, *client_addr_str_ptr, *server_addr_str, *server_addr_str_ptr, - *log_client_prefix, *log_conn_prefix, *log_req_prefix, - *client_host_str, *client_geoip; +char *log_client_prefix, *log_conn_prefix, *log_req_prefix, *client_geoip; struct timeval client_timeout = {.tv_sec = CLIENT_TIMEOUT, .tv_usec = 0}; diff --git a/src/necronda-server.h b/src/necronda-server.h index 9fb6b64..0e5ee7d 100644 --- a/src/necronda-server.h +++ b/src/necronda-server.h @@ -81,4 +81,6 @@ int sockets[NUM_SOCKETS]; pid_t children[MAX_CHILDREN]; MMDB_s mmdbs[MAX_MMDB]; +char *client_addr_str, *client_addr_str_ptr, *server_addr_str, *server_addr_str_ptr, *client_host_str; + #endif //NECRONDA_SERVER_NECRONDA_SERVER_H diff --git a/src/rev_proxy.c b/src/rev_proxy.c index bc46c61..2f14a24 100644 --- a/src/rev_proxy.c +++ b/src/rev_proxy.c @@ -99,6 +99,8 @@ int rev_proxy_init(http_req *req, http_res *res, host_config *conf, sock *client rev_proxy: http_remove_header_field(&req->hdr, "Connection", HTTP_REMOVE_ALL); http_add_header_field(&req->hdr, "Connection", "keep-alive"); + http_remove_header_field(&req->hdr, "X-Forwarded-For", HTTP_REMOVE_ALL); + http_add_header_field(&req->hdr, "X-Forwarded-For", client_addr_str); ret = http_send_request(&rev_proxy, req); if (ret < 0) {