Closed papaya09 closed 5 months ago
Do you have a video of what you are seeing?
Is there anything in your browser console logs or network tab?
https://github.com/thenick775/gbajs3/assets/72320174/cdea5c5e-01ac-4513-a232-0ca4f73dc998
Is there something wrong ?
Could you repeat your video above with "preserve log" checked in the network/console tabs?
I'm curious what happens before your redirected.
I'll look further into this later today
https://github.com/thenick775/gbajs3/assets/72320174/1ecd8a4a-1e6e-464e-90bd-be3404747d69
I see that there is an API error appearing
Could you show me the payload and response tabs of the failed admin login requests?
The errors your seeing with fonts should be inconsequential, probably an issue in goadmin
Just a bit of info as I try to reproduce:
This is for gba accounts (you set these up in the admin):
Admin accounts won't work when logging into the form above.
This is the correct admin login, currently I am attempting to debug and reproduce your scenario, but this is where you would log in and create gba users:
Alright, I've found your installation, and I can see something in the cookie headers that leads me to believe it may be your .env
config.
The response here from your signin
request contains the following cookie:
Set-Cookie:
go_admin_session=e9e2da00-79a2-4d9a-ada8-4633ee0da81c; Path=/; Domain=localhost; Expires=Wed, 15 May 2024 01:56:15 GMT; Max-Age=7200; HttpOnly
Notice that the domain is localhost
.
What is the contents of your .env
file CLIENT_HOST
in your hosted installation?
It should be set to https://patroldex.com
or https://patroldex.com:7443
instead of https://localhost
This is most likely the cause of your issues. The default docker compose setup is geared towards everything being behind 1 domain/host (CLIENT_HOST
in ./docker/.env
), this should be the address of your website as shown above.
Edit: confirmed this is your issue, your GBA user login requests are also pointing to localhost
For completeness, here is the whole ordeal explained:
When you boot the services, some of them need to know what the host or domain of the client (the frontend, this being the gameboy in the browser).
In this case, the frontend, the auth service, and the admin service, all use this for different reasons, since we are assumed to be on the same domain:
CLIENT_HOST
to make requests to the auth serviceCLIENT_HOST
to set CORS/auth headers for the frontendCLIENT_HOST
to set CORS/auth headers for itselfThis makes things more secure, and allows these services in the way they are built here to know what a user on the web will be visiting from ahead of time.
For example here is how I set the CLIENT_HOST
value on my hosted installation:
...
CLIENT_HOST=https://gba.nicholas-vancise.dev
...
Since that is the domain users will be visiting to play the gameboy.
In your case, you left the CLIENT_HOST
as:
...
CLIENT_HOST=https://localhost
...
in your .env
file.
This is causing all requests to point to localhost between the services.
That is why your gba service is trying to log in making requests to localhost.
The same is true for your admin.
The signin
request is returning 200
, as the default username/password works.
But when it returns the set cookie header shown above for the admin signin
, its for localhost
not patroldex
.
This causes you to redirect to the login screen for the admin, because it is correctly rejecting your cookies/session used for authentication.
Set your CLIENT_HOST
to either https://patroldex.com
or https://patroldex.com:7334
.
I do not know how non-standard ports (7443
) will play with all the interconnections or api requests yet, since I haven't needed to use one. If this causes you additional problems after trying out both of the CLIENT_HOST
values above, I'll make some changes to assist in supporting that.
Hope this helps, and I'll let you close this issue if it does 😎
Feel free to keep commenting here for assistance if needed, and thanks for those videos!
https://github.com/thenick775/gbajs3/assets/72320174/c451e48f-f7b6-4b6f-8884-647b479e6655
After successfully logging in, the page appears blank, is it something blocking it ? My Web
Your docker image has the environment variable cached i think.
I'm still seeing your admin pointing to localhost.
The white screen is most likely you failing 5+ requests, and fail2ban will ban you for ~5 minutes the first time.
I would delete your docker images, and rebuild with the adjusted CLIENT_HOST
you have set above, should be as simple as docker compose down && docker system prune && docker compose up --build
Thank you for your help. I used docker system prune
and reinstalled the entire project. It's available now.
I recently installed a project on my hosting server and configured Let's Encrypt for SSL/TLS encryption. However, I'm encountering an issue where I am unable to access the admin page. Whenever I try to log in, the page refreshes without any error message or indication of successful login. Anyway to solve this ?