Skip to content

Instantly share code, notes, and snippets.

View nginx_logformat.txt
log_format main '$remote_addr - "$http_x_forwarded_for" - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent "$http_referer" '
'"$http_user_agent"' ;
View curl_normal_request_example.txt
curl http://aws-lb-adresiniz.elb.amazonaws.com/
@ceylani
ceylani / curl_header_manipulation_example.txt
Created Dec 2, 2016
curl header manipulation example
View curl_header_manipulation_example.txt
curl -i --header "X-Forwarded-For: 1.1.1.1, 2.2.2.2" http://aws-lb-adresiniz.elb.amazonaws.com/
@ceylani
ceylani / gcloud_lb_real_ip.txt
Last active Dec 2, 2016
Getting real IP address from gcloud HTTP LB
View gcloud_lb_real_ip.txt
function getClientIP()
{
if ($_SERVER['HTTP_X_FORWARDED_FOR']) {
$ip_exp = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
$c = count($ip_exp) - 2;
$real_ip = trim($ip_exp[$c]);
return $_SERVER['REMOTE_ADDR'] = $real_ip;
} else {
return $_SERVER['REMOTE_ADDR'];
}
@ceylani
ceylani / aws_lb_real_ip.txt
Last active Dec 2, 2016
Getting real IP address from AWS LB
View aws_lb_real_ip.txt
function getClientIP()
{
if ($_SERVER['HTTP_X_FORWARDED_FOR']) {
$ip_exp = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
$c = count($ip_exp) - 1;
$real_ip = trim($ip_exp[$c]);
return $_SERVER['REMOTE_ADDR'] = $real_ip;
} else {
return $_SERVER['REMOTE_ADDR'];
}
You can’t perform that action at this time.