顯示具有 ELB 標籤的文章。 顯示所有文章
顯示具有 ELB 標籤的文章。 顯示所有文章

2017年8月30日 星期三

Redirect http into https using load balancer

https://forums.aws.amazon.com/thread.jspa?messageID=745509

The Apache block above caused our ELB health check to fail from the HTTP 301 response. To allow this and other local requests over HTTP while redirecting external requests through the ELB to HTTPS, adjust the rewrite condition to match on http instead of a negative match on https:

RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} ^http$
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]