Button to API route returns 404 but direct hit functions
I think I am running into an issue with the router and im 99% sure there is something I am missing.
Im building out an oauth flow. I am able to get the access_token stored as a cookie. I am building the logout flow which is a SolidStart API route that accepts a
GET
request and just deletes the cookie. Hitting the api route with httpie or via curl returns a 302 to the home page as expected but the button that is a href to the same route returns a 404. I am at a loss why the API route can be hit from httpie, works if I manually go to localhost:3000/auth/logout, but not from the button.
I can copy and paste the link the button has and it works, just not when I actually press the button.
Here is the button:
And this is the src/routes/auth/logout.tsx
:
3 Replies
Is this because I am client side routing to the API? Adding
use server
does not change the behavior. If so, how to I eject out of this behavior on a per route basis?not per route basis but per link basis opt out or opt in
to opt out:
1. rel=external
2. target=“_self” // or _top or anything valid
to get the opt in mode
1. pass ‘explicitLinks’ in Router
2. use ‘<A />’
this was the default at some point, luckily it was made to be configurable
https://github.com/solidjs/solid-router#router
OOOHHH that makes total sense! Thank you!!!!!
I was looking through the docs but missed thie completely. this explains the exact behavior I was seeing.