Difference between revisions of "AWS/ELB"

From Ever changing code
< AWS
Jump to navigation Jump to search
(Created page with "= Use Nginx to preserve headers/client IP when working with ELB = If you configure ELB for Http/s then headers forwardes but if you decide to use TCP load balancing <source...")
 
Line 1: Line 1:
= Use Nginx to preserve headers/client IP when working with ELB =
= Use Nginx to preserve headers/client IP when working with ELB =
If you configure ELB for Http/s then headers forwardes but if you decide to use TCP load balancing  
If you configure ELB for Http/s then headers forwardes (application layer mode) but if you decide to use TCP load balancing ELB is not not aware of any headers. For this we going to use Nginx to proxy_websocket connections L4 TCP.


<source lang=bash>
<source lang=bash>

Revision as of 22:41, 26 March 2019

Use Nginx to preserve headers/client IP when working with ELB

If you configure ELB for Http/s then headers forwardes (application layer mode) but if you decide to use TCP load balancing ELB is not not aware of any headers. For this we going to use Nginx to proxy_websocket connections L4 TCP.

sudo apt-get install nginx
systemctl status nginx
tail -f /var/log/nginx/access.log
pip install awscli==1.6.6
aws configure
aws elb describe-load-balancer-policy-types
aws elb create-load-balancer-policy --load-balancer-name linuxacademy-protocol-policy --policy-name "<POLICY NAME>" --policy-type-name ProxyProtocolPolicyType --policy-attributes AttributeName=Proxy Protocol, AttributeValue-true
aws elb describe-load-balancer-policies --load-balancer-name aws "<LOAD BALANCER NAME>"
aws elb set-load-balancer-policies-for-backend-server --load-balancer-name "<LOAD BALANCER NAME>" --instance-port 80 --policy-names linuxacademy-protocol-policy
cd /etc
cd nginx/
vim nginx.conf
systemctl restart nginx