<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>HTTP redirect &#8211; Blog of Kliment Andreev &#8211; A place so I won&#039;t forget things</title>
	<atom:link href="https://blog.andreev.it/tag/http-redirect/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.andreev.it</link>
	<description></description>
	<lastBuildDate>Thu, 05 Nov 2020 16:21:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>AWS: Use Application Load Balancer (ALB) for multi-domain permanent redirect (301) HTTP-&gt;HTTPS</title>
		<link>https://blog.andreev.it/2019/07/aws-use-application-load-balancer-alb-for-multi-domain-permanent-redirect-301-http-https/</link>
					<comments>https://blog.andreev.it/2019/07/aws-use-application-load-balancer-alb-for-multi-domain-permanent-redirect-301-http-https/#respond</comments>
		
		<dc:creator><![CDATA[Kliment Andreev]]></dc:creator>
		<pubDate>Mon, 15 Jul 2019 15:55:58 +0000</pubDate>
				<category><![CDATA[AWS]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[301]]></category>
		<category><![CDATA[ALB]]></category>
		<category><![CDATA[HTTP redirect]]></category>
		<category><![CDATA[HTTPS redirct]]></category>
		<guid isPermaLink="false">https://blog.andreev.it/?p=5423</guid>

					<description><![CDATA[At work, we have multiple brands and sites with different legal pages. The management&#8230;]]></description>
										<content:encoded><![CDATA[<div id="bsf_rt_marker"></div><p>At work, we have multiple brands and sites with different legal pages. The management decided to redirect all of these pages from multiple domains to point to a separate page on the main brand domain. It looks like this, <strong>legal.brand1.com</strong> will redirect to <strong>www.maindomain.com/brand1-legal</strong>, <strong>legal.brand2.com</strong> will redirect to <strong>www.maindomain.com/brand2-legal</strong> etc. While I was researching how to do this the easiest way, I&#8217;ve found some old articles that suggest using S3 buckets. This won&#8217;t work for me because it doesn&#8217;t support HTTPs. If you are looking to redirect HTTP traffic only, <a href="https://docs.aws.amazon.com/AmazonS3/latest/user-guide/redirect-website-requests.html" rel="noopener noreferrer" target="_blank">this </a>is the way to go and you can skip this article. There is a workaround to use S3 and CloudFront, but <a href="https://simonecarletti.com/blog/2016/08/redirect-domain-https-amazon-cloudfront/" rel="noopener noreferrer" target="_blank">this </a>setup uses AWS issued certificates and I have my own. Finally, I&#8217;ve found an article that explains how to do this using an application load balancer in AWS. Here is a link to the <a href="https://medium.com/tensult/multiple-site-redirections-using-aws-application-load-balancer-35bc0d5da6ad" rel="noopener noreferrer" target="_blank">article</a>. I&#8217;ll expand a little bit more.<br />
<strong>NOTE:</strong> Your sites doesn&#8217;t have to be hosted in AWS for the redirect to work. They can be hosted anywhere. Even in your basement. The only requirement is to have an ALB, SSL certificates and access to modify the DNS for the destination domain.<br />
Here is my setup. I have 3 domains, all with valid HTTPS certificates and the destination domain DNS is in Cloudflare (the free version). We&#8217;ll redirect the following URLs as described below.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-01.png"><img decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-01.png" alt="" width="473" height="72" class="aligncenter size-full wp-image-8609" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-01.png 473w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-01-300x46.png 300w" sizes="(max-width: 473px) 100vw, 473px" /></a><br />
The redirection will work for both HTTP and HTTPS. </p>
<h1>SSL certificates</h1>
<p>From the AWS console, open up the <strong>Certificate Manager</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-02.jpg"><img fetchpriority="high" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-02.jpg" alt="" width="648" height="279" class="aligncenter size-full wp-image-8610" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-02.jpg 648w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-02-300x129.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-02-585x252.jpg 585w" sizes="(max-width: 648px) 100vw, 648px" /></a><br />
Click on <strong>Get started</strong> under <strong>Provision certificates</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-03.jpg"><img decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-03.jpg" alt="" width="554" height="367" class="aligncenter size-full wp-image-8611" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-03.jpg 554w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-03-300x199.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-03-263x175.jpg 263w" sizes="(max-width: 554px) 100vw, 554px" /></a><br />
Click on <strong>Import a certificate</strong> from the top of the page.<br />
Paste your certificate under the <strong>Certificate body</strong> which is your actual certificate in PEM format (usual extensions CER or CRT), then paste your <strong>private key</strong> (usual extension KEY) and the <strong>certificate chain</strong> (usual extensions CA or ca-bundle). The certificate chain is a combination of the CA certificate (the certificate of your certificate authority) and the intermediate certificate (you get these when you buy a certificate). Once completed click on <strong>Review and import</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-04.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-04.jpg" alt="" width="1007" height="535" class="aligncenter size-full wp-image-8612" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-04.jpg 1007w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-04-300x159.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-04-768x408.jpg 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-04-585x311.jpg 585w" sizes="(max-width: 1007px) 100vw, 1007px" /></a><br />
Click <strong>Import</strong>. Do this for the certificates for both source URL domains. You don&#8217;t have to install the certificate for the destination domain.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-05.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-05.jpg" alt="" width="1029" height="289" class="aligncenter size-full wp-image-8613" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-05.jpg 1029w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-05-300x84.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-05-1024x288.jpg 1024w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-05-768x216.jpg 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-05-585x164.jpg 585w" sizes="(max-width: 1029px) 100vw, 1029px" /></a></p>
<h1>ALB (Application Load Balancer)</h1>
<p>From the AWS console, go to EC2 service and then on the left side, look for <strong>Load Balancers</strong>. Click on <strong>Create Load Balancer</strong> and select <strong>Application Load Balancer</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-06.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-06.jpg" alt="" width="1327" height="528" class="aligncenter size-full wp-image-8614" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-06.jpg 1327w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-06-300x119.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-06-1024x407.jpg 1024w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-06-768x306.jpg 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-06-1170x466.jpg 1170w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-06-585x233.jpg 585w" sizes="(max-width: 1327px) 100vw, 1327px" /></a><br />
For<strong> step 1</strong>, name the load balancer (<strong>elbRedirect </strong>in my case), make sure it&#8217;s <strong>internet-facing</strong> and <strong>ipv4</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-07.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-07.jpg" alt="" width="761" height="285" class="aligncenter size-full wp-image-8615" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-07.jpg 761w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-07-300x112.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-07-585x219.jpg 585w" sizes="(max-width: 761px) 100vw, 761px" /></a><br />
Click <strong>Add listener</strong> and add <strong>HTTPS</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-08.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-08.jpg" alt="" width="1323" height="254" class="aligncenter size-full wp-image-8616" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-08.jpg 1323w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-08-300x58.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-08-1024x197.jpg 1024w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-08-768x147.jpg 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-08-1170x225.jpg 1170w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-08-585x112.jpg 585w" sizes="(max-width: 1323px) 100vw, 1323px" /></a><br />
Choose at least two subnets. It really doesn&#8217;t matter what subnets you&#8217;ll choose even if your sites are hosted in AWS. We are using ALB as Layer 7 device, so the location is not important.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-09.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-09.jpg" alt="" width="886" height="411" class="aligncenter size-full wp-image-8617" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-09.jpg 886w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-09-300x139.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-09-768x356.jpg 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-09-585x271.jpg 585w" sizes="(max-width: 886px) 100vw, 886px" /></a><br />
Click on <strong>Next: Configure Security Settings</strong>.<br />
Choose a certificate for the domain that you want to redirect first. If you have only one certificate, choose that one.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-10.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-10.jpg" alt="" width="1340" height="501" class="aligncenter size-full wp-image-8618" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-10.jpg 1340w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-10-300x112.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-10-1024x383.jpg 1024w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-10-768x287.jpg 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-10-1170x437.jpg 1170w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-10-585x219.jpg 585w" sizes="(max-width: 1340px) 100vw, 1340px" /></a><br />
Click on <strong>Next: Configure Security Groups</strong>.<br />
For <strong>step 3</strong>, select to <strong>Create a new security group</strong>, name it, add a description and add both HTTP and HTTPS from 0.0.0.0/0 (everywhere) as a rule.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-11.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-11.jpg" alt="" width="1340" height="505" class="aligncenter size-full wp-image-8619" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-11.jpg 1340w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-11-300x113.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-11-1024x386.jpg 1024w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-11-768x289.jpg 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-11-1170x441.jpg 1170w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-11-585x220.jpg 585w" sizes="(max-width: 1340px) 100vw, 1340px" /></a><br />
Click on <strong>Next: Configure Routing</strong>.<br />
For <strong>step 4</strong>, select <strong>New target group</strong> and name it (tgRedirect in my case). You can leave everything else as-is. It&#8217;s not relevant.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-12.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-12.jpg" alt="" width="1337" height="505" class="aligncenter size-full wp-image-8620" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-12.jpg 1337w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-12-300x113.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-12-1024x387.jpg 1024w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-12-768x290.jpg 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-12-1170x442.jpg 1170w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-12-585x221.jpg 585w" sizes="(max-width: 1337px) 100vw, 1337px" /></a><br />
Click on <strong>Next: Register Targets</strong>. Even if you have your servers in AWS, it doesn&#8217;t matter. A target is necessary for an ALB, but we are not using that functionality. Just click <strong>Next: Review</strong> and if everything looks good, click <strong>Create </strong>under <strong>step 6</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-13.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-13.jpg" alt="" width="1341" height="510" class="aligncenter size-full wp-image-8621" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-13.jpg 1341w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-13-300x114.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-13-1024x389.jpg 1024w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-13-768x292.jpg 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-13-1170x445.jpg 1170w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-13-585x222.jpg 585w" sizes="(max-width: 1341px) 100vw, 1341px" /></a><br />
It takes about a minute or two to provision the load balancer. While it&#8217;s provisioning get the DNS name of the load balancer (under <strong>Description </strong>tab).<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-14.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-14.jpg" alt="" width="1109" height="442" class="aligncenter size-full wp-image-8622" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-14.jpg 1109w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-14-300x120.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-14-1024x408.jpg 1024w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-14-768x306.jpg 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-14-585x233.jpg 585w" sizes="(max-width: 1109px) 100vw, 1109px" /></a></p>
<h2>Rules</h2>
<p>Click on the <strong>Listeners </strong>tab and then <strong>View/edit rules</strong> for port 80. You&#8217;ll see the Rules page.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-15.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-15.jpg" alt="" width="1090" height="389" class="aligncenter size-full wp-image-8623" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-15.jpg 1090w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-15-300x107.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-15-1024x365.jpg 1024w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-15-768x274.jpg 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-15-585x209.jpg 585w" sizes="(max-width: 1090px) 100vw, 1090px" /></a><br />
Click on the <strong>plus (+)</strong> sign to add a new rule then click on <strong>(+) Insert Rule</strong>. Click on <strong>(+) Add condition</strong> and then select <strong>Host header</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-16.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-16.jpg" alt="" width="1195" height="399" class="aligncenter size-full wp-image-8624" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-16.jpg 1195w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-16-300x100.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-16-1024x342.jpg 1024w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-16-768x256.jpg 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-16-1170x391.jpg 1170w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-16-585x195.jpg 585w" sizes="(max-width: 1195px) 100vw, 1195px" /></a><br />
Enter the first source URL in my case <strong>legal.andreev.it</strong>. Then on the right, click <strong>(+) Add action</strong> and select <strong>Redirect to&#8230;</strong>I&#8217;ll redirect <strong>legal.andreev.it</strong> to <strong>https://www.futurebit.com/legal-andreev</strong> so my config looks like this.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-17.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-17.png" alt="" width="649" height="153" class="aligncenter size-full wp-image-8626" /></a><br />
Click <strong>Save </strong>in the upper right corner.<br />
<strong>IMPORTANT:</strong> Do the same for port 443. In the upper right corner where it says <strong>albRedirect | HTTP:80</strong> click on the <strong>down arrow</strong> and select port <strong>443</strong>. Again, create the Host header rule and the Redirect rule. These should be the same for port 80 and 443. See screenshot above.<br />
Before we test further, make sure that your destination URLs are working.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-18.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-18.png" alt="" width="649" height="153" class="aligncenter size-full wp-image-8630" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-18.png 649w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-18-300x71.png 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-18-585x138.png 585w" sizes="(max-width: 649px) 100vw, 649px" /></a></p>
<h1>DNS</h1>
<p>Go to the DNS of the source domain and add a CNAME record for <strong>legal.andreev.it</strong> to point to the load balancer&#8217;s DNS. This is what it looks like for my setup.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-19.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-19.jpg" alt="" width="848" height="68" class="aligncenter size-full wp-image-8631" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-19.jpg 848w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-19-300x24.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-19-768x62.jpg 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-19-585x47.jpg 585w" sizes="(max-width: 848px) 100vw, 848px" /></a><br />
Make sure that your CNAME resolves. If the redirect doesn&#8217;t work, ping your source domain (in my case <strong>legal.andreev.it</strong>) first and see if it resolves. If it doesn&#8217;t &#8211; wait until the DNS replication is completed.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-20.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-20.jpg" alt="" width="794" height="102" class="aligncenter size-full wp-image-8632" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-20.jpg 794w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-20-300x39.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-20-768x99.jpg 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-20-585x75.jpg 585w" sizes="(max-width: 794px) 100vw, 794px" /></a><br />
Once the replication is completed, the redirection should work. My destination domain is behind Cloudflare. This is the config in DNS.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-21.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-21.jpg" alt="" width="1017" height="175" class="aligncenter size-full wp-image-8633" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-21.jpg 1017w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-21-300x52.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-21-768x132.jpg 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-21-585x101.jpg 585w" sizes="(max-width: 1017px) 100vw, 1017px" /></a><br />
I don&#8217;t have any page rules there. I do the redirect on Apache level. It really doesn&#8217;t matter where you do the redirects from HTTP to HTTPS. The only setting I have is under <strong>Crypto </strong>option in Cloudflare. The SSL is set to <strong>Full </strong>instead of <strong>Flexible </strong>which is the default. If you have <strong>too many redirects</strong> errors, this is probably the cause.</p>
<h1>Add second certificate</h1>
<p>By now, you have one domain working. If you want to add the second domain, you have to attach a certificate to the ALB listener. Go to the ALB, click on the <strong>Listeners </strong>tab and click <strong>View/edit certificates</strong>. Click on the plus (+) sign and select a new certificate, then click <strong>Add</strong>. In my case, I just added the second certificate <strong>iandreev.com</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P133-22.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P133-22.jpg" alt="" width="909" height="525" class="aligncenter size-full wp-image-8634" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P133-22.jpg 909w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-22-300x173.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-22-768x444.jpg 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P133-22-585x338.jpg 585w" sizes="(max-width: 909px) 100vw, 909px" /></a><br />
Now, if you want to add the second domain redirect, just go back to <a href="https://blog.andreev.it/?p=5423#Rules">Rules </a>and redo everything for the 2nd domain.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.andreev.it/2019/07/aws-use-application-load-balancer-alb-for-multi-domain-permanent-redirect-301-http-https/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
