Sending X-Forwarded-For
This commit is contained in:
		@@ -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};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user