azukaar / Cosmos-Server

☁️ The Most Secure and Easy Selfhosted Home Server. Take control of your data and privacy without sacrificing security and stability (Authentication, anti-DDOS, anti-bot)
https://cosmos-cloud.io
Other
3.15k stars 113 forks source link

[BUG]: can't login using HTTP #8

Closed stanol closed 1 year ago

stanol commented 1 year ago

What happened?

When I try to log in, I am redirected to the same login page.

What should have happened?

I must access the control panel.

How to reproduce the bug?

Install the cosmos and select "use http only" when configuring.

Relevant log output

2023/05/09 14:10:29 [INFO] Docker API version: 1.41

2023/05/09 14:10:29 [INFO] Starting in /app

2023/05/09 14:10:29 [INFO] TLS certificates do not exists or are disabled, starting HTTP server only

2023/05/09 14:10:29 [INFO] Listening to HTTP on : [serverIP]:8080

2023/05/09 14:10:38 [INFO] SmartShield: Request received

2023/05/09 14:10:38 [ERROR] LoggedInOnly: User is not logged in : 

2023/05/09 14:10:38 [ERROR] HTTP Request returned Error 401 : User not logged in : 

2023/05/09 14:10:38 "GET http://[serverIP]:8080/cosmos/api/status HTTP/1.1" from [myIP]:50642 - 401 67B in 484.754µs

2023/05/09 14:10:38 [INFO] SmartShield: Request received

2023/05/09 14:10:38 [ERROR] LoggedInOnly: User is not logged in : 

2023/05/09 14:10:38 [ERROR] HTTP Request returned Error 401 : User not logged in : 

2023/05/09 14:10:38 "GET http://[serverIP]:8080/cosmos/api/config HTTP/1.1" from [myIP]:47543 - 401 67B in 209.292µs

2023/05/09 14:10:38 "GET http://[serverIP]:8080/cosmos/api/me HTTP/1.1" from [myIP]:50642 - 401 67B in 296.973µs

2023/05/09 14:10:38 [INFO] SmartShield: Request received

2023/05/09 14:10:38 [ERROR] AdminOrItselfOnly: User is not logged in : 

2023/05/09 14:10:38 [ERROR] HTTP Request returned Error 401 : User not logged in : 

2023/05/09 14:10:39 "GET http://[serverIP]:8080/cosmos/api/can-send-email HTTP/1.1" from [myIP]:47543 - 200 46B in 321.598µs

2023/05/09 14:10:39 [INFO] SmartShield: Request received

2023/05/09 14:10:40 [INFO] SmartShield: Request received

2023/05/09 14:10:40 [ERROR] AdminOrItselfOnly: User is not logged in : 

2023/05/09 14:10:40 [ERROR] HTTP Request returned Error 401 : User not logged in : 

2023/05/09 14:10:40 "GET http://[serverIP]:8080/cosmos/api/me HTTP/1.1" from [myIP]:50642 - 401 67B in 336.135µs

2023/05/09 14:10:41 [INFO] SmartShield: Request received

2023/05/09 14:10:41 [INFO] (Re) Connecting to the database...

2023/05/09 14:10:41 [INFO] Successfully connected to the database.

2023/05/09 14:10:43 "POST http://[serverIP]:8080/cosmos/api/login HTTP/1.1" from [myIP]:47543 - 200 16B in 1.403475821s

2023/05/09 14:10:44 [INFO] SmartShield: Request received

2023/05/09 14:10:44 [ERROR] LoggedInOnly: User is not logged in : 

2023/05/09 14:10:44 [ERROR] HTTP Request returned Error 401 : User not logged in : 

2023/05/09 14:10:44 "GET http://[serverIP]:8080/cosmos/api/config HTTP/1.1" from [myIP]:50642 - 401 67B in 316.842µs

2023/05/09 14:10:44 "GET http://[serverIP]:8080/cosmos/api/status HTTP/1.1" from [myIP]:47543 - 401 67B in 220.446µs

2023/05/09 14:10:44 [INFO] SmartShield: Request received

2023/05/09 14:10:44 [ERROR] LoggedInOnly: User is not logged in : 

2023/05/09 14:10:44 [ERROR] HTTP Request returned Error 401 : User not logged in : 

2023/05/09 14:10:44 [INFO] SmartShield: Request received

2023/05/09 14:10:44 [ERROR] AdminOrItselfOnly: User is not logged in : 

2023/05/09 14:10:44 [ERROR] HTTP Request returned Error 401 : User not logged in : 

2023/05/09 14:10:44 "GET http://[serverIP]:8080/cosmos/api/me HTTP/1.1" from [myIP]:50642 - 401 67B in 373.585µs

2023/05/09 14:10:46 [INFO] SmartShield: Request received

2023/05/09 14:10:46 "GET http://[serverIP]:8080/cosmos/api/can-send-email HTTP/1.1" from [myIP]:47543 - 200 46B in 277.907µs

2023/05/09 14:10:46 [INFO] SmartShield: Request received

2023/05/09 14:10:46 [ERROR] AdminOrItselfOnly: User is not logged in : 

2023/05/09 14:10:46 [ERROR] HTTP Request returned Error 401 : User not logged in : 

2023/05/09 14:10:46 "GET http://[serverIP]:8080/cosmos/api/me HTTP/1.1" from [myIP]:50642 - 401 67B in 281.437µs

2023/05/09 14:12:31 [INFO] SmartShield: Request received

2023/05/09 14:12:33 "POST http://[serverIP]:8080/cosmos/api/login HTTP/1.1" from [myIP]:47543 - 200 16B in 2.340464996s

2023/05/09 14:12:34 [INFO] SmartShield: Request received

2023/05/09 14:12:34 [INFO] SmartShield: Request received

2023/05/09 14:12:34 [ERROR] LoggedInOnly: User is not logged in : 

2023/05/09 14:12:34 [ERROR] LoggedInOnly: User is not logged in : 

2023/05/09 14:12:34 [ERROR] HTTP Request returned Error 401 : User not logged in : 

2023/05/09 14:12:34 [ERROR] HTTP Request returned Error 401 : User not logged in : 

2023/05/09 14:12:34 "GET http://[serverIP]:8080/cosmos/api/config HTTP/1.1" from [myIP]:50642 - 401 67B in 3.955137ms

2023/05/09 14:12:34 "GET http://[serverIP]:8080/cosmos/api/status HTTP/1.1" from [myIP]:47543 - 401 67B in 3.947019ms

2023/05/09 14:12:35 [INFO] SmartShield: Request received

2023/05/09 14:12:35 [ERROR] AdminOrItselfOnly: User is not logged in : 

2023/05/09 14:12:35 [ERROR] HTTP Request returned Error 401 : User not logged in : 

2023/05/09 14:12:35 "GET http://[serverIP]:8080/cosmos/api/me HTTP/1.1" from [myIP]:50642 - 401 67B in 377.288µs

2023/05/09 14:12:36 [INFO] SmartShield: Request received

2023/05/09 14:12:36 "GET http://[serverIP]:8080/cosmos/api/can-send-email HTTP/1.1" from [myIP]:47543 - 200 46B in 384.902µs

2023/05/09 14:12:36 "GET http://[serverIP]:8080/cosmos/api/me HTTP/1.1" from [myIP]:50642 - 401 67B in 260.198µs

2023/05/09 14:12:36 [INFO] SmartShield: Request received

2023/05/09 14:12:36 [ERROR] AdminOrItselfOnly: User is not logged in : 

2023/05/09 14:12:36 [ERROR] HTTP Request returned Error 401 : User not logged in : 

2023/05/09 14:12:37 [INFO] SmartShield: Request received

2023/05/09 14:12:40 "POST http://[serverIP]:8080/cosmos/api/login HTTP/1.1" from [myIP]:47543 - 200 16B in 2.36012871s

2023/05/09 14:12:41 "GET http://[serverIP]:8080/cosmos/api/status HTTP/1.1" from [myIP]:47543 - 401 67B in 224.275µs

2023/05/09 14:12:41 [INFO] SmartShield: Request received

2023/05/09 14:12:41 [INFO] SmartShield: Request received

2023/05/09 14:12:41 [ERROR] LoggedInOnly: User is not logged in : 

2023/05/09 14:12:41 [ERROR] HTTP Request returned Error 401 : User not logged in : 

2023/05/09 14:12:41 [ERROR] LoggedInOnly: User is not logged in : 

2023/05/09 14:12:41 [ERROR] HTTP Request returned Error 401 : User not logged in : 

2023/05/09 14:12:41 "GET http://[serverIP]:8080/cosmos/api/config HTTP/1.1" from [myIP]:50642 - 401 67B in 711.317µs

2023/05/09 14:12:41 [INFO] SmartShield: Request received

2023/05/09 14:12:41 [ERROR] AdminOrItselfOnly: User is not logged in : 

2023/05/09 14:12:41 [ERROR] HTTP Request returned Error 401 : User not logged in : 

2023/05/09 14:12:41 "GET http://[serverIP]:8080/cosmos/api/me HTTP/1.1" from [myIP]:47543 - 401 67B in 318.09µs

2023/05/09 14:12:43 [INFO] SmartShield: Request received

2023/05/09 14:12:43 "GET http://[serverIP]:8080/cosmos/api/can-send-email HTTP/1.1" from [myIP]:50642 - 200 46B in 272.706µs

2023/05/09 14:12:43 [INFO] SmartShield: Request received

2023/05/09 14:12:43 [ERROR] AdminOrItselfOnly: User is not logged in : 

2023/05/09 14:12:43 [ERROR] HTTP Request returned Error 401 : User not logged in : 

2023/05/09 14:12:43 "GET http://[serverIP]:8080/cosmos/api/me HTTP/1.1" from [myIP]:47543 - 401 67B in 399.727µs

Other details

No problems with login if I use https.

System details

azukaar commented 1 year ago

Thanks for the report it should be fixed in v0.4.1, let me know

stanol commented 1 year ago

Thanks, it works now.