#Cannot make payload work with other js apps due to the routes

1 messages · Page 1 of 1 (latest)

dense lagoon
#

frontend server on localhost 3000
payload on localhost 5000

I have nginx, I redirected api route and admin route (And everything inside of them) to 5000, reverse proxy.

localhost/admin correctly redirects to localhost/admin/login
The login screen works, once I log in there is a blank screen, checked the console and saw that

localhost:5000/api/access fetch request has errors

When I properly go to localhost:5000/admin it works
localhost/admin doesnt, payload is not working with reverse proxies.

#

{"errors":[{"message":"Cannot read properties of undefined (reading 'role')"}]}

#

So i am debugging it rn and found out that in the req variable of the access control middleware the "user" object isn't there

#

weird

#

that question mark (user?.role) wasn't there before

#

that was why the error was there, now I put question mark there

#

but even when I log in it says that I am not authenticated for admin

#

the user object is NOT there when reverse proxying from localhost to localhost:5000

#

It must be logged in via localhost:5000

dense lagoon
#

Nevermind got it to work both on production and dev

#

*without the slash

#

at the end