~sircmpwn/sr.ht-discuss

9 5

Adding the option to redirect domains in pages

Details
Message ID
<167024006717.7.6255972077300958297.81535825@ploum.eu>
DKIM signature
pass
Download raw message
Hi,

I currently have my blog on https://ploum.net

But I also want it on several other domains: www.ploum.net, ploum.be,
www.ploum.be and, soon, ploum.eu, www.ploum.eu

Currently, my .build.yml has to do 4 deployments which takes a lot of
time and ressource (and increase probability of failure, see the other
thread).

I was wondering if there could be an option in .build.yml to tell
sourcehut that a domain should point to an existing deployed website. It
could either be transparent (the user see it as a different website) or
a 307/308 code redirect.

What do you think?

--
Ploum - Lionel Dricot
Blog: https://www.ploum.net — Livres: https://ploum.net/livres
Gemini : gemini://ploum.be
Details
Message ID
<COTUPLNHSXJK.1TFUMVN7ZRF48@taiga>
In-Reply-To
<167024006717.7.6255972077300958297.81535825@ploum.eu> (view parent)
DKIM signature
pass
Download raw message
You could use a meta tag to redirect
Details
Message ID
<167024081364.7.4009701778152964566.81537764@ploum.eu>
In-Reply-To
<COTUPLNHSXJK.1TFUMVN7ZRF48@taiga> (view parent)
DKIM signature
pass
Download raw message
On 22/12/05 12:35, Drew DeVault - sir at cmpwn.com wrote:
>You could use a meta tag to redirect


Do you mean doing a custom index.html with redirect meta and uploading
only that file to each domain?

(sorry, if it is obvious for everyone but me, never thought of that so I
need to clarify)

--
Ploum - Lionel Dricot
Blog: https://www.ploum.net
Livres: https://ploum.net/livres.html
Details
Message ID
<COTUYNO8MH0A.20BJ99CJ4J9I@taiga>
In-Reply-To
<167024081364.7.4009701778152964566.81537764@ploum.eu> (view parent)
DKIM signature
pass
Download raw message
Yeah
Details
Message ID
<167024130480.7.8174869718121584819.81538983@ploum.eu>
In-Reply-To
<COTUYNO8MH0A.20BJ99CJ4J9I@taiga> (view parent)
DKIM signature
pass
Download raw message
On 22/12/05 12:47, Drew DeVault - sir at cmpwn.com wrote:
>Yeah

But would it work for every URLs?

If someone access ploum.be/blalbla.html, is will it be redirected to
ploum.net/blabla.html if the meta is only in index.html?

With Apache, I will play with an .htaccess but I don’t know if something
similar is available on sourcehut.  (that would be very helpful so I can
reduce the amount of duplicated content)


--
Ploum - Lionel Dricot
Blog: https://www.ploum.net
Livres: https://ploum.net/livres.html
Details
Message ID
<COTV9PUQ31KO.GXZONGQ90GW2@hera>
In-Reply-To
<167024130480.7.8174869718121584819.81538983@ploum.eu> (view parent)
DKIM signature
pass
Download raw message
On Mon Dec 5, 2022 at 12:54 PM CET,  wrote:
> But would it work for every URLs?
No, it would not. Your "best" bet using Sourcehut Pages that I am aware
of is running a small shellscript that operates on the generated site
(preferably after it's packed) and replaces the file content with the
HTML+Meta-Tag. This way you could add the complete path without much
hazzle. Avoiding the multiple uploads is as far as I know not possible.

-- 
Moritz Poldrack
https://moritz.sh
Details
Message ID
<167024259146.7.1096252043092106626.81544117@ploum.eu>
In-Reply-To
<COTV9PUQ31KO.GXZONGQ90GW2@hera> (view parent)
DKIM signature
pass
Download raw message
On 22/12/05 01:03, Moritz Poldrack - moritz at poldrack.dev wrote:
>On Mon Dec 5, 2022 at 12:54 PM CET,  wrote:
>> But would it work for every URLs?
>No, it would not. Your "best" bet using Sourcehut Pages that I am aware
>of is running a small shellscript that operates on the generated site
>(preferably after it's packed) and replaces the file content with the
>HTML+Meta-Tag. This way you could add the complete path without much
>hazzle. Avoiding the multiple uploads is as far as I know not possible.
>

That’s how I understand it. That’s why I’m suggesting it as a new
potential feature.

I think that "htaccess-kind redirections" are a mess but maybe simply
indicating "domain2 should redirect to domain1" in build.yml could be
simple and powerful enough to cover a lot of usecases (if only the
"www.domain/naked domain" thing)
Details
Message ID
<ef9096cb-ef44-41d7-8e20-aab2f4e9f015@app.fastmail.com>
In-Reply-To
<167024259146.7.1096252043092106626.81544117@ploum.eu> (view parent)
DKIM signature
missing
Download raw message
I think this kind a redirection is sometimes available at your registrar.
For instance Gandi seems to propose this: https://docs.gandi.net/en/domain_names/common_operations/web_forwarding.html

(They don’t document if the path is preserved or not)

Olivier
Details
Message ID
<CP2049JY70R0.3HSN20GBV4E0Y@ramon>
In-Reply-To
<COTUPLNHSXJK.1TFUMVN7ZRF48@taiga> (view parent)
DKIM signature
pass
Download raw message
I was just wondering about this possibility today. Prior to hosting my
site on srht.site, I simply used a CNAME record to point www.example.com
at example.com and ensured that the TLS certificate was valid for both
domains. Visiting www.example.com/page and example.com/page both worked
great, without needing to do any redirects.

However, the CNAME approach doesn't work with srht.site -- although the
www domain still resolves to the correct IP address, the TLS certificate
provided by srht.site is invalid for the www. I could deal with this by
uploading my site multiple times, once to www.example.com and once to
example.com as has been mentioned, but that feels silly and wasteful.

IMO, the simplest way to solve this would be to allow users to specify
multiple domains in the same publish API request. That way the site
content would only need to be transferred once, but srht.site could
serve the content with a valid certificate on all specified domains.

-- 
Jason Cox
jasoncarloscox.com
Details
Message ID
<167109630797.8.6428648670764692045.84081605@ploum.eu>
In-Reply-To
<CP2049JY70R0.3HSN20GBV4E0Y@ramon> (view parent)
DKIM signature
pass
Download raw message
On 22/12/14 08:31, Jason Cox - me at jasoncarloscox.com wrote:
>I was just wondering about this possibility today. Prior to hosting my
>site on srht.site, I simply used a CNAME record to point www.example.com
>at example.com and ensured that the TLS certificate was valid for both
>domains. Visiting www.example.com/page and example.com/page both worked
>great, without needing to do any redirects.
>
>However, the CNAME approach doesn't work with srht.site -- although the
>www domain still resolves to the correct IP address, the TLS certificate
>provided by srht.site is invalid for the www. I could deal with this by
>uploading my site multiple times, once to www.example.com and once to
>example.com as has been mentioned, but that feels silly and wasteful.
>
>IMO, the simplest way to solve this would be to allow users to specify
>multiple domains in the same publish API request. That way the site
>content would only need to be transferred once, but srht.site could
>serve the content with a valid certificate on all specified domains.

That’s indeed a very good solution. It doesn’t even need a CNAME record
anymore. I would appreciate this feature.
Reply to thread Export thread (mbox)