-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
gitea/gitea:latest Docker image redirects everything with 302 to / #13725
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
Comments
+1 |
The CSS changed a lot between 1.12 and 1.13 - could you double check that you don't have the old one cached. Ctrl-f5 stuff. That's usually the problem. Next thing check if you're using custom templates and if so - make sure they're up to date. Give us some information about your app.ini eg if you're using static root path, a subpathor the like. Also olease use the issue template we provided. Master moves a lot so the sha reference is also helpful and if you could give us some logs that's also really helpful. |
From Docker hub: gitea/gitea:latest (broken): gitea/gitea:1.12.6 (working): From docker images:
Is the issue not reproducible with the command lines above?
This is literally an untouched docker container, which should be easy to reproduce and have the same behaivor on every machine. I am sure that this is not only a problem on my machine because the second poster agreed with me. Please tell me if you need more information. |
I ran into this redirect issue recently as well: $ curl --head http://localhost:3000/css/index.css\?v\=759b74ce43947f5f4c91aeddc3e5bad3
HTTP/1.1 302 Found
Content-Type: text/html; charset=utf-8
Location: http://localhost:3000/
Set-Cookie: lang=en-US; Path=/; Max-Age=2147483647
Set-Cookie: i_like_gitea=8c39ec8a7b469e83; Path=/; HttpOnly
Set-Cookie: _csrf=_xTnXq5hXbfq9vPESFmYZH9lq8s6MTYwNjU3MDM3NjAwOTIwMTAwMA; Path=/; Expires=Sun, 29 Nov 2020 13:32:56 GMT; HttpOnly
X-Frame-Options: SAMEORIGIN
Date: Sat, 28 Nov 2020 13:32:56 GMT I don't have any issues when building and running the tag |
The bug should be related with installation page but not related non-install pages. |
@lunny
|
Found the bug from the chi's source codes. If there is no any handler defined but only middlewares, then all middlewares will be ignored. So I have to define one handler for install routes.
|
Oh, it's actually an issue in chi? |
Works: diff --git a/routers/routes/chi.go b/routers/routes/chi.go
index 5ff7a728f..00689441b 100644
--- a/routers/routes/chi.go
+++ b/routers/routes/chi.go
@@ -230,6 +230,12 @@ func RegisterInstallRoute(c chi.Router) {
m := NewMacaron()
RegisterMacaronInstallRoute(m)
+ // We need at least one handler in chi so that it does not drop
+ // our middleware: https://github.com/go-gitea/gitea/issues/13725#issuecomment-735244395
+ c.Get("/", func(w http.ResponseWriter, req *http.Request) {
+ m.ServeHTTP(w, req)
+ })
+
c.NotFound(func(w http.ResponseWriter, req *http.Request) {
m.ServeHTTP(w, req)
}) |
@shilch Could you send a patch to Gitea? |
I'll do |
When running gitea for the first time, the stylesheets for the installation page are broken since the middleware that statically serves stylesheets does not get executed by chi. This is because if no handlers are registered in chi, it will drop all middleware. This commit introduces a "dummy" handler to deal with that quirk. Closes #13725 Thanks: Lunny Xiao <[email protected]> for finding the quirk Co-authored-by: Lunny Xiao <[email protected]>
All images and style-sheets are redirected to
/
withHTTP 302
(For examplehttp://localhost:3000/img/loading.png
tohttp://localhost:3000/
in my case).working:
broken:
The text was updated successfully, but these errors were encountered: