PostOwl / postowl

Create a personal website for your blog, journal and sending letters to friends.
https://www.postowl.com
GNU Affero General Public License v3.0
99 stars 6 forks source link

Share link is broken in production (`origin` not resolved) #31

Closed keybits closed 1 year ago

keybits commented 1 year ago

The secret share link in emails to Friends and the link that can be copied from the UI are both broken when deployed to production.

This broke after we refactored and removed ORIGIN as a hard-coded enironment variable at build time.

As per the SvelteKit docs we're setting PROTOCOL_HEADER=x-forwarded-proto HOST_HEADER=x-forwarded-host when starting the app.

This should make origin available as a property of url.

Can we fix to make the links correct?

Examples of broken links

For the email we get a link in the form:

http://letters/your-post?secret=V55F90GJZ1XwoJzvreoUm

For the copyable link it gives:

undefined/letters/your-post?secret=V55F90GJZ1XwoJzvreoUm

We get undefined because we're not correctly getting origin in line 13 of CopyableRecipient.svelte:

$: origin = $page.data.origin;
michael commented 1 year ago

Fixed via: https://github.com/PostOwl/postowl/commit/729e32bc3f476dd3d0038eb1f97aca7c3e17d4bc