<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ben Farcy</title>
    <description>The latest articles on DEV Community by Ben Farcy (@benteoneb).</description>
    <link>https://dev.to/benteoneb</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F119550%2F57eb6b44-d90b-4f5f-9a10-a1d40ba57323.jpeg</url>
      <title>DEV Community: Ben Farcy</title>
      <link>https://dev.to/benteoneb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/benteoneb"/>
    <language>en</language>
    <item>
      <title>How to setup google domain for gitlab pages with http and https</title>
      <dc:creator>Ben Farcy</dc:creator>
      <pubDate>Sun, 26 May 2019 15:56:55 +0000</pubDate>
      <link>https://dev.to/benteoneb/how-to-setup-google-domain-for-gitlab-pages-with-http-and-https-36lk</link>
      <guid>https://dev.to/benteoneb/how-to-setup-google-domain-for-gitlab-pages-with-http-and-https-36lk</guid>
      <description>&lt;p&gt;If like me, you want to redirect a &lt;strong&gt;gitlab pages&lt;/strong&gt; website to a domain you own through &lt;strong&gt;google domain&lt;/strong&gt;, this is for you.&lt;br&gt;
I found the information for &lt;strong&gt;github pages&lt;/strong&gt; &lt;a href="https://dev.to/trentyang/how-to-setup-google-domain-for-github-pages-1p58"&gt;here&lt;/a&gt;, but was looking for the gitlab specifics and could not find it easily.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Purchased a &lt;a href="https://domains.google.com"&gt;google&lt;/a&gt; domain, such as &lt;strong&gt;example.com&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Set up a &lt;a href="https://docs.gitlab.com/ee/user/project/pages/"&gt;gitlab pages&lt;/a&gt; website, available on a gitlab project link&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Set up
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Gitlab configuration
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;1. Go to &lt;em&gt;Setting&lt;/em&gt;/&lt;em&gt;Pages&lt;/em&gt;, uncheck &lt;em&gt;Force HTTPS (require valid certificates)&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;2. Go to &lt;em&gt;New Domain&lt;/em&gt;, enter the name of your demain such as &lt;strong&gt;example.com&lt;/strong&gt;, then confirm with &lt;em&gt;Create New Domain&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;3. Still in &lt;em&gt;Setting&lt;/em&gt;/&lt;em&gt;Pages&lt;/em&gt;, go to the &lt;em&gt;Details&lt;/em&gt; of your newly added domain &lt;strong&gt;example.com&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;4. &lt;em&gt;Copy to clipboard&lt;/em&gt; the generated &lt;em&gt;Verification status&lt;/em&gt; string that looks like that: &lt;code&gt;_gitlab-pages-verification-code.example.com TXT gitlab-pages-verification-code=1234abcd&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Google domain configuration
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Warning&lt;/strong&gt;: if you just bought your google domain, you may not be able to see the effect of below actions just yet. DNS propagation can take several hours.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;5. Go to your google domain account and &lt;em&gt;manage&lt;/em&gt; your domain such as &lt;strong&gt;example.com&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;6. Go to &lt;em&gt;DNS&lt;/em&gt; on the left pane and scroll down to &lt;em&gt;Custom resource records&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;7. Add a first record with default name &lt;code&gt;@&lt;/code&gt;, default type &lt;code&gt;A&lt;/code&gt;, default &lt;a href="https://www.dnsknowledge.com/whatis/time-to-live-ttl/"&gt;TTL&lt;/a&gt; &lt;code&gt;1H&lt;/code&gt; and IPV4 address &lt;code&gt;35.185.44.232&lt;/code&gt;. This is the gitlab pages IP, you can check it out &lt;a href="https://docs.gitlab.com/ee/user/project/pages/getting_started_part_three.html#dns-a-record"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;8. Add a second record with default name &lt;code&gt;@&lt;/code&gt;, type &lt;code&gt;TXT&lt;/code&gt; default &lt;a href="https://www.dnsknowledge.com/whatis/time-to-live-ttl/"&gt;TTL&lt;/a&gt; &lt;code&gt;1H&lt;/code&gt; and paste your gitlab verification code here&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At this step, you can check that the record is well set by pinging your domain. You can try a &lt;code&gt;ping example.com&lt;/code&gt;, or a &lt;code&gt;dig example.com&lt;/code&gt;, in your terminal and the gitlab pages IP should show up. If not, check the steps above.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;9. Go back to your gitlab, &lt;em&gt;Setting&lt;/em&gt;/&lt;em&gt;Pages&lt;/em&gt;, go to the &lt;em&gt;Details&lt;/em&gt; of your domain &lt;strong&gt;example.com&lt;/strong&gt;, check the &lt;em&gt;Verification Status&lt;/em&gt; and retry verification if needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Voilà&lt;/strong&gt;, now when you go to &lt;code&gt;http://example.com&lt;/code&gt; you should see your gitlab page. Do not worry too much if you see a 404 error from Gitlab, it can take several minutes to propagate.&lt;/p&gt;

&lt;p&gt;You can stop here or go on to unlock &lt;strong&gt;www&lt;/strong&gt; and &lt;strong&gt;https&lt;/strong&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  World Wide Web prefix
&lt;/h4&gt;

&lt;p&gt;If you want to have the &lt;strong&gt;www&lt;/strong&gt; prefix work as well, follow the same steps as before, but with &lt;code&gt;www.example.com&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;10. Go to gitlab &lt;em&gt;Setting&lt;/em&gt;/&lt;em&gt;Pages&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;11. Go to &lt;em&gt;New Domain&lt;/em&gt;, enter the name of your domain with &lt;strong&gt;www&lt;/strong&gt; like &lt;strong&gt;&lt;a href="http://www.example.com"&gt;www.example.com&lt;/a&gt;&lt;/strong&gt;, then confirm with &lt;em&gt;Create New Domain&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;12. Still in &lt;em&gt;Setting&lt;/em&gt;/&lt;em&gt;Pages&lt;/em&gt;, go to the &lt;em&gt;Details&lt;/em&gt; of your newly added domain &lt;strong&gt;&lt;a href="http://www.example.com"&gt;www.example.com&lt;/a&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;13. &lt;em&gt;Copy to clipboard&lt;/em&gt; the generated &lt;em&gt;Verification status&lt;/em&gt; string that looks like that: &lt;code&gt;_gitlab-pages-verification-code.example.com TXT gitlab-pages-verification-code=1234abcd&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;14. Go again tp your google domain account and &lt;em&gt;manage&lt;/em&gt; your domain such as &lt;strong&gt;example.com&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;15. Go to &lt;em&gt;DNS&lt;/em&gt; on the left pane and scroll down to &lt;em&gt;Custom resource records&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;16. Add a third record with default name &lt;code&gt;www&lt;/code&gt;, default type &lt;code&gt;A&lt;/code&gt;, default &lt;a href="https://www.dnsknowledge.com/whatis/time-to-live-ttl/"&gt;TTL&lt;/a&gt; &lt;code&gt;1H&lt;/code&gt; and IPV4 address &lt;code&gt;35.185.44.232&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;17. Add a second record with default name &lt;code&gt;www&lt;/code&gt;, type &lt;code&gt;TXT&lt;/code&gt; default &lt;code&gt;1H&lt;/code&gt; and paste your gitlab verification code here&lt;/li&gt;
&lt;li&gt;18. Go back to your gitlab, &lt;em&gt;Setting&lt;/em&gt;/&lt;em&gt;Pages&lt;/em&gt;, go to the &lt;em&gt;Details&lt;/em&gt; of your domain &lt;strong&gt;&lt;a href="http://www.example.com"&gt;www.example.com&lt;/a&gt;&lt;/strong&gt;, check the &lt;em&gt;Verification Status&lt;/em&gt; and retry verification if needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Voilà&lt;/strong&gt;, now when you go to &lt;code&gt;http://www.example.com&lt;/code&gt; you should see your gitlab page. Again, do not worry too much if you see a 404 error from Gitlab, it can take several minutes to propagate.&lt;/p&gt;

&lt;h4&gt;
  
  
  HTTPS
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;19. Those official &lt;a href="https://docs.gitlab.com/ee/user/project/pages/lets_encrypt_for_gitlab_pages.html"&gt;gitlab instructions&lt;/a&gt; worked very well for me &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Juste make sure to certify at the same time your &lt;code&gt;example.com&lt;/code&gt; and your &lt;code&gt;www.example.com&lt;/code&gt; domain, by putting both domain in the certbot command:&lt;br&gt;
&lt;code&gt;&lt;br&gt;
sudo certbot certonly -a manual -d example.com -d www.example.com --email name@email.com&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That's all, you should now have access to your website through:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;http://www.example.com&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;http://example.com&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;https://www.example.com&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;https://example.com&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>googledomain</category>
      <category>gitlabpages</category>
    </item>
  </channel>
</rss>
