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

Stop choking if BASE_URL includes origin (fix #979) #994

Merged

Conversation

devinrhode2
Copy link
Contributor

@devinrhode2 devinrhode2 commented Aug 11, 2023

PR Checklist

  • Tests for the changes have been added (for bug fixes / features)

Not sure how to test this: Do we have any tests that set a flag in vite, and then run the app to see there are no errors?

We could also move the code change into @solidjs/router, but this is a fix for SolidStart, and I'm not sure where it makes the most sense to add this small guard.

PR Type

  • Bugfix

What is the current behavior?

Setting this in vite.config.ts:

  base: 'http://localhost:1234'.

Would cause Solid's router to crash, because it wasn't expecting base urls to include origins. Solid's router expects a base path, without an origin.

What is the new behavior?

Before we pass Vite's BASE_URL to Solid's router, check for and remove any origin, by checking if the BASE_URL starts with 'http'.

Closes #979

@ryansolid ryansolid merged commit c11e275 into solidjs:main Aug 11, 2023
9 checks passed
@devinrhode2 devinrhode2 deleted the devin/avoid-choking-on-origin-in-base-url branch August 11, 2023 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants