#Redirect not working when referring to a proxy server

1 messages · Page 1 of 1 (latest)

void maple
#

Hello
i have a proxy server that handles login and logout through /api/auth

when unverified user tries to enter a route, i have a function that checks if a user is logged in and then redirects it to /api/auth/login if not logged in

remix redirect tries to find a route that matches this pattern instead of hitting the proxy middleware.

i found this thread: https://github.com/remix-run/remix/issues/3765
but it seems there's only a workaround for client side navigation but i want it to work server side!

any solutions?

thanks in advance!

GitHub

What version of Remix are you using? 1.5.1 Steps to Reproduce I have a Remix Form that submits a GET request to a UI-route's loader function, which can either return a JSON object or redire...

frail sonnet
#

I’m unsure of your exact setup, but if you specify a full url instead of /api/auth/login you might have more success. I currently have an app that interops with another app and we redirect to the other app using the full https://www.yoururl.com/yourPathName

#

I know you’re on the same url but perhaps providing the full path will at least hit the proxy before it hits remix, otherwise remix assumes it’s internal and doesn’t bother making a true network request would be my guess

#

I’m not 100% that’s what happens, but I wouldn’t doubt that redirect to a /route is probably optimized by remix somehow

void maple
void maple
#

Came across this thing!
remix actually disables redirect on the server and doing a fetch request on the client!!!!!
this behavior is pretty lame and causes A LOT OF MISUNDERSTANDINGS AND DEBUGGING FOR NOTHING!

these kind of things makes me think that remix is not production ready.

the minimal thing to do is letting us decide if to replace the location header and doing the fetch on the client or ACTUALLY REDIRECT
https://github.com/remix-run/remix/issues/2997

GitHub

What version of Remix are you using? 1.4.1 Steps to Reproduce Create a Remix project (with the built in Remix server) with the following routes: index.tsx: import { memo } from 'react&#...

frail sonnet
#

that certainly is disappointing, hopefully theres an easy enough work around for your desired behavior.