Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: change default api url value #354

Merged
merged 2 commits into from
Sep 8, 2023
Merged

chore: change default api url value #354

merged 2 commits into from
Sep 8, 2023

Conversation

BayBreezy
Copy link
Contributor

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

When using any node version above 16, the cookie was not being persisted across browser refreshes. Changing "http://localhost:1337" -> "http://127.0.0.1:1337" fixed this issue. Refer to this issue: #229

Resolves: #229

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes (if not applicable, please state why)

When using any node version above 16, the cookie was not being persisted across browser refreshes.
Changing "http://localhost:1337" -> "http://127.0.0.1:1337" fixed this issue.
Refer to this issue: #229
@nuxt-studio
Copy link

nuxt-studio bot commented Aug 11, 2023

Live Preview ready!

Name Edit Preview Latest Commit
Strapi Edit on Studio ↗︎ View Live Preview 0dcd0a9

src/module.ts Outdated Show resolved Hide resolved
@benjamincanac benjamincanac merged commit 4901cdd into nuxt-modules:dev Sep 8, 2023
1 check passed
@benjamincanac
Copy link
Member

I'm so sorry it took so long to merge, thank you! 😊

Copy link
Member

As a note, when using an oauth provider, this does imply changing the Callback URL and setting the HOST to 127.0.0.1 in your Strapi config.

@BayBreezy
Copy link
Contributor Author

As a note, when using an oauth provider, this does imply changing the Callback URL and setting the HOST to 127.0.0.1 in your Strapi config.

Thanks. I think ppl would know to do that, I may be wrong tho..
Do you think it should be mentioned in the docs?

Copy link
Member

I tried quickly to do it on a Strapi 3 API but didn't managed to changed the HOST to 127.0.0.1, it always fallbacks to localhost.

@HenrijsS
Copy link

Hey.

I changed the host already to 127.0.0.1, because my cookies were getting cleared, but the issue persists.

The URL is getting overwritten, then rewritten back from localhost to 127.0.0.1

Video: https://share.cleanshot.com/JphHZDtB

Also got a hydration mismatch.

Copy link
Member

Reverted this in favor of: 93b8bb8

@BayBreezy
Copy link
Contributor Author

Good going 👍🏽

Copy link
Member

@BayBreezy Have you tried it? Does it work for you?

@BayBreezy
Copy link
Contributor Author

Not yet lol.
But it seems like a better option

@BayBreezy
Copy link
Contributor Author

@benjamincanac Yes, it works. I update strapi to 4.15.4 & Nuxt to 3.8.2 on Node v18.18.1
The URL in my .env is STRAPI_URL=http://localhost:1337 and it keeps the cookie in place event after a refresh. So the user stays logged in.
Good job 👍🏽

@rrubio
Copy link

rrubio commented Jan 4, 2024

@BayBreezy just checking. I've upgraded my strapi instance and nuxt to match yours. I'm still having the same issue. On your .env file, under a dev, prod environment that url will need to be what ever the strapi hosting URL is. I'm assuming you have changed that and tested ok?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useStrapiUser or fetchUser Reload Issue
4 participants