~sircmpwn/sr.ht-discuss

6 5

Custom domains with sourcehut pages

Details
Message ID
<000001d97d57$caca69b0$605f3d10$@niktivan.org>
DKIM signature
missing
Download raw message
Hello,

I am trying to figure out how to add the `www` second-level domain to my
sourcehut pages custom domain website.

I am using the command `tar -cvz index.html > site.tar.gz` to package the
tar and `hut pages publish -d niktivan.org site.tar.gz` to publish it.

The site works fine at niktivan.org.

I have further added the following CNAME record to my registrar's DNS config
as per https://srht.site/custom-domains:

CNAME Record    www     pages.sr.ht.

If I visit www.niktivan.org I get the following:

```
An error occurred during a connection to www.niktivan.org. Peer reports it
experienced an internal error.

Error code: SSL_ERROR_INTERNAL_ERROR_ALERT

    The page you are trying to view cannot be shown because the authenticity
of the received data could not be verified.
    Please contact the web site owners to inform them of this problem.
```

I am not sure which part I have set up incorrectly.

Thanks for any help!
Details
Message ID
<168308532738.8.10083347751452064065.125864114@moritz.poldrack.dev>
In-Reply-To
<000001d97d57$caca69b0$605f3d10$@niktivan.org> (view parent)
DKIM signature
missing
Download raw message
On Wed May 3, 2023 at 2:39 AM CEST, Ivan - ivan at niktivan.org wrote:
> Error code: SSL_ERROR_INTERNAL_ERROR_ALERT

That's the error returned by caddy while it's fetching a certificate. Nothing
to worry about. Just try again later.

-- 
Moritz Poldrack
https://moritz.sh
Details
Message ID
<20F6D6FD-BD48-487C-B4CC-1C0D7832E8EC@lobber.eu>
In-Reply-To
<000001d97d57$caca69b0$605f3d10$@niktivan.org> (view parent)
DKIM signature
missing
Download raw message
Hi Ivan,

On May 3, 2023 2:39:58 AM GMT+02:00, Ivan <ivan@niktivan.org> wrote:
>Hello,
>
>I am trying to figure out how to add the `www` second-level domain to my
>sourcehut pages custom domain website.
>
>I am using the command `tar -cvz index.html > site.tar.gz` to package the
>tar and `hut pages publish -d niktivan.org site.tar.gz` to publish it.
>
>The site works fine at niktivan.org.
>
>I have further added the following CNAME record to my registrar's DNS config
>as per https://srht.site/custom-domains:
>
>CNAME Record    www     pages.sr.ht.
>
>If I visit www.niktivan.org I get the following:
>
>```
>An error occurred during a connection to www.niktivan.org. Peer reports it
>experienced an internal error.
>
>Error code: SSL_ERROR_INTERNAL_ERROR_ALERT
>
>    The page you are trying to view cannot be shown because the authenticity
>of the received data could not be verified.
>    Please contact the web site owners to inform them of this problem.
>```
>
>I am not sure which part I have set up incorrectly.
>
The error is caused by the SSL/TLS certificate generated. Because you publish your site as niktivan.org, the certificate auto generated is for niktivan.org only. When you try to access as www.niktivan.org the certificate does not match the name of the site and raises an error (you should have a certificate for www.niktivan.org instead).

IIRC this is an expected limitation. One workaround is to publish your site twice, once with each name, or to add a redirect from one name to the other (www -> blank or the other way around). For the redirect you'd have to set it up with an html page published in the other name, like explained here: https://stackoverflow.com/questions/5411538/how-to-redirect-one-html-page-to-another-on-load#5411567

Regards,
Miguel
Details
Message ID
<CSCIH2W2WRFU.16DRXGZJNP83U@taiga>
In-Reply-To
<20F6D6FD-BD48-487C-B4CC-1C0D7832E8EC@lobber.eu> (view parent)
DKIM signature
missing
Download raw message
You need to publish twice, once per subdomain.
Details
Message ID
<57033f6d-fbfd-1472-7905-18ab996c3d6b@niktivan.org>
In-Reply-To
<20F6D6FD-BD48-487C-B4CC-1C0D7832E8EC@lobber.eu> (view parent)
DKIM signature
missing
Download raw message
Hi,

I published twice and everything works now.
Thank you everyone for the help!

The HTML redirect also works, thanks for that info.
-- 
Ivan Nikitin
https://niktivan.org
Details
Message ID
<5e495aa7fd395968194fe87249cdc8ab@leaversmith.com>
In-Reply-To
<57033f6d-fbfd-1472-7905-18ab996c3d6b@niktivan.org> (view parent)
DKIM signature
missing
Download raw message
May 3, 2023 3:18 PM, "Ivan Nikitin" <ivan@niktivan.org> wrote:

> Hi,
> 
> I published twice and everything works now.
> Thank you everyone for the help!
> 
> The HTML redirect also works, thanks for that info.
> -- Ivan Nikitin
> https://niktivan.org

You want to remove this line from the non-www. domain as it's refreshing the page
every second :) 

    <meta http-equiv="refresh" content="0; url=https://niktivan.org/" />

--
Oliver Leaver-Smith
+44 (0) 7450 217 558 | +44 (0) 114 360 1337
oliver@leaversmith.com
TZ=Europe/London
BD3C 73DF 33FF 729A B4B7 2C0B E7BF 2699 1650 3BFB
Details
Message ID
<7d764808-8ca2-c67c-f4a9-c26789f1be99@niktivan.org>
In-Reply-To
<20F6D6FD-BD48-487C-B4CC-1C0D7832E8EC@lobber.eu> (view parent)
DKIM signature
missing
Download raw message
Thanks for pointing that out!
-- 
Ivan Nikitin
https://niktivan.org
Reply to thread Export thread (mbox)