writefreely / writefreely

A clean, Markdown-based publishing platform made for writers. Write together and build a community.
https://writefreely.org
GNU Affero General Public License v3.0
4.54k stars 321 forks source link

In multi-domain environment App > host setting causes some links to break #662

Open GSI opened 1 year ago

GSI commented 1 year ago

App > host causes certain links to point to the configured setting.

When a blog is made available through multiple domains, this may not equal the currently visited domain.

Within clearnet this use case is unlikely, but it may arise when a blog is made available through additional means like Tor or i2p.

In such a case a user may be viewing the article index of example.i2p and find the links to the detail view point to example.org/some-title.

Links that omit the domain part (e.g. href="/some-title/edit") aren't affected and work as expected.

thebaer commented 1 year ago

Can you share a list of the particular links that aren't working in this case? Would be great to solve this so it works through multiple domains like this.

GSI commented 1 year ago

It's been a while, but I did a quick test and so far I can only see it at http://127.0.0.1:8080/read

It's easy to test with host set to localhost:8080, but actually browsing 127.0.0.1:8080. Every link that now still points to localhost if affected.

I'm not familiar with Go and the templating used, but .CanonicalURL or .CanonicalURL .Host in the tmpl-files seem to play a role.