alexbelgium / hassio-addons

My homeassistant addons
MIT License
1.5k stars 214 forks source link

🐛 [Mealie] Direct link to meals plan page redirects incorrectly #1210

Open nickj-git opened 8 months ago

nickj-git commented 8 months ago

Description

Using the Mealie add-on on Home Assistant Yellow, within Mealie the meal plan opens fine, however when opening a new browser tab to http://x.x.x.x:9090/group/mealplan/planner/view the browser redirects to http://127.0.0.1:9000/group/mealplan/planner/view/

Reproduction steps

1. In the Mealie menu, click on "Meal Planner"
2. Copy the URL of the meal planner page (e.g. http://x.x.x.x:9090/group/mealplan/planner/ )
3. Open a new browser tab and paste the copied address
4. The Meal Planner page does not load. The URL in the navigation bar will change to http://127.0.0.1:9000/group/mealplan/planner/view/

Addon Logs

When loading the Meal Planner via the Mealie menu - 200 response:

127.0.0.1:39718 - "GET /api/groups/mealplans?page=1&perPage=-1&start_date=2024-01-28&end_date=2024-02-03 HTTP/1.1" 200
[28/Jan/2024:16:41:06 +1100] 200 -(192.168.1.221) GET /api/groups/mealplans?page=1&perPage=-1&start_date=2024-01-28&end_date=2024-02-03 HTTP/1.1 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:122.0) Gecko/20100101 Firefox/122.0)

When loading the Meal Planner via the URL directly in any browser window - 307 response:

127.0.0.1:45846 - "GET /group/mealplan/planner/view HTTP/1.1" 307
[28/Jan/2024:16:41:33 +1100] 307 -(192.168.1.221) GET /group/mealplan/planner/view HTTP/1.1 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:122.0) Gecko/20100101 Firefox/122.0)

Architecture

No response

OS

HAos

alexbelgium commented 8 months ago

Easiest way would be for me to drop ssl and just propose a direct connection without nginx. Alas this is also the reason why ingress can't be supported... I'll look at it thanks

shirou93 commented 8 months ago

Without SSL when i try refresh on user panel i still got redirect to http://localhost:9000/user/profile/

github-actions[bot] commented 8 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

shirou93 commented 8 months ago

Currently this issue still occurs.

thuesen commented 7 months ago

Can confirm, I see the same issue. So far I've given up trying to figure out why it redirects me when I try to open the meal planner using a direct link. Direct links to other areas (like a recipe) works fine.

nickj-git commented 6 months ago

Without SSL when i try refresh on user panel i still got redirect to http://localhost:9000/user/profile/

As per the bug report it was done using http. I've not tested https so not sure if there's any difference there, but yeah without ssl it definitely happens

thuesen commented 6 months ago

As per the bug report it was done using http. I've not tested https so not sure if there's any difference there, but yeah without ssl it definitely happens

I use https, and also get redirected same as you.

AndrewDarlington commented 2 months ago

I'm also having this problem. I first noticed this with the invite link, which is generated/emailed in this format:
 https://mealie.mydomain.com/register?token={token}

When I go to that link, it immediately refreshes as:

http://localhost:9000/register/?token={token}

Note that it changes my domain to “localhost:9000” AND it adds a slash between “register” and the question mark. If I change the domain back (but leave the added slash), then it works:

https://mealie.mydomain.com/register/?token={token}

Likewise, when I navigate to Mealy locally (http://10.0.1.10:9091/ -- fyi, I use 9091 because another service uses 9090), the generated invitation link looks like http://10.0.1.10:9091/register?token={token} which then redirects to http://localhost:9000/register/?token={token}. And similarly to using the external link, if I adjust the registration link to include that extra slash (i.e. http://10.0.1.10:9091/register/?token={token} ), then the registration page loads and I can register a new user.

broy-bt commented 1 month ago

I also have this issue when trying to go to settings. For example if I go to https://mealie.xxxxxxxx.com/user/profile and then click settings, it redirects to http://localhost:9000/user/profile/

I do access my site through an nginx reverse proxy, and if I go through http://x.x.x.x:9090/ everything works fine, except it yells at me for not using SSL.