massenergize / frontend-portal

Front End Code for the MassEnergize Community Portal. The community portal is customized for each participating community, and has the canonical URL https://community.massenergize.org/<community-name>/. For example, https://community.massenergize.org/wayland/.
MIT License
5 stars 2 forks source link

On Safari, Custom Url is replaced by the generic community.massenergize.org/subdomain #1336

Open BradHN1 opened 3 months ago

BradHN1 commented 3 months ago

Describe the bug

When you visit a site with custom domain on Safari, the URL changes to the generic URL.
This is causing an infinite loop in safari for sites with custom URLs, so has been promoted to CRITICAL bug

The following code in AppRouter causes the problem, and I don't remember why it is there. @frimpongopoku if (browswerIsSafari() && siteUsesCustomDomain()) { const subd = pathname.toLowerCase().indexOf(subdomain.toLowerCase()) > -1 ? "" : "/" + subdomain; window.location.href = MASSENERGIZE_PRODUCTION_URL + subd + pathname; }

To Reproduce

Steps to reproduce the behavior:

  1. Open Safari browser on laptop or mobile device
  2. Go to EnergizeWayland.org
  3. See error in the URL browser bar

Expected behavior

The URL should show the custom URL.

Screenshots or video

If applicable, add screenshots or video to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context

Bug reported by Mike Roy from Energy Navigators - he wants this fixed soon.