Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't login when use http://IP:port #29451

Closed
MattMaBX opened this issue Feb 27, 2024 · 10 comments
Closed

Can't login when use http://IP:port #29451

MattMaBX opened this issue Feb 27, 2024 · 10 comments
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail

Comments

@MattMaBX
Copy link

MattMaBX commented Feb 27, 2024

Description

I have edited the config of ROOT_URL to my domain, because I have to visit the website out of LAN by frp.
But I can't login when use http://IP:port. When I click login, I will be redirected to home page.

2024-02-27.21.40.23.mov

And if I visit my gitea by my domain, it will be fine.

default.mov

That's my app.ini:
image

Gitea Version

1.21.6

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

Git Version

No response

Operating System

Ubuntu 22.04

How are you running Gitea?

Docker

Database

SQLite

@lunny lunny added issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail and removed type/bug labels Feb 27, 2024
@lunny
Copy link
Member

lunny commented Feb 27, 2024

Please confirm you can visit it normally from your LAN. Otherwise, find the problem of your FRP configuration.

@MattMaBX
Copy link
Author

Please confirm you can visit it normally from your LAN. Otherwise, find the problem of your FRP configuration.

Thanks for the reply!
I confirmed that I can visit it from LAN normally, and also, I can clone my projects by both http://172.22.66.88:3000/Matt/xxxx and [email protected]:22/Matt/xxxx in my LAN.
Besides, I find that if I change the ROOT_URL to my IP address, I will be able to log in normally, but I need to set ROOT_URL to my domain name to ensure normal access out of LAN. That's the problem.

@yp05327
Copy link
Contributor

yp05327 commented Feb 29, 2024

Can you provide some details about the login post request in network tab?

@charles7668
Copy link
Contributor

charles7668 commented Feb 29, 2024

I tested this issue. When the ROOT_URL is configured to use HTTPS, logging in using HTTP will redirect to the home page, rather than the IP:port. However, using HTTP for the ROOT_URL works fine.

@yp05327
Copy link
Contributor

yp05327 commented Feb 29, 2024

By my test, if login success, it will always redirect to "/", so no matter what ROOT_URL is, it should redirect to the correct URL.

@charles7668
Copy link
Contributor

charles7668 commented Feb 29, 2024

By my test, if login success, it will always redirect to "/", so no matter what ROOT_URL is, it should redirect to the correct URL.

I believe this problem is related to PR #26999. When loading a page using HTTP, the browser detects that the cookie is secure and prevents the addition of other cookies. As a result, Gitea cannot verify the login information.

Therefore, this may not be a bug, as this security feature is provided by the browser.

image

@MattMaBX
Copy link
Author

I tested this issue. When the ROOT_URL is configured to use HTTPS, logging in using HTTP will redirect to the home page, rather than the IP:port. However, using HTTP for the ROOT_URL works fine.

Wow, that's worked. When I set the ROOT_URL without HTTPS, that will be fine! But I don't know if there is a BUG or that's just a normal feature.
Anyway, this setting solved my problem. Thanks.

@MattMaBX
Copy link
Author

Can you provide some details about the login post request in network tab?

Sure.
image
image
Is it enough?

@GiteaBot
Copy link
Collaborator

We close issues that need feedback from the author if there were no new comments for a month. 🍵

@go-gitea go-gitea locked as resolved and limited conversation to collaborators Jun 28, 2024
@wxiaoguang
Copy link
Contributor

"Unable to login" usually means some cookie problems (>99% cases)

For example, using "https" means "https-only cookie", then it doesn't work with http (config option: COOKIE_SECURE)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail
Projects
None yet
Development

No branches or pull requests

6 participants