Skip to content

401 reposonse has wrong HTTP headers #35319

@hramrach

Description

@hramrach

Description

wget -SO- https://demo.gitea.com/api/v1/user
--2025-08-19 20:37:41--  https://demo.gitea.com/api/v1/user
Resolving demo.gitea.com (demo.gitea.com)... 52.40.189.212
Connecting to demo.gitea.com (demo.gitea.com)|52.40.189.212|:443... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 401 Unauthorized
  Alt-Svc: h3=":443"; ma=2592000
  Cache-Control: max-age=0, private, must-revalidate, no-transform
  Content-Length: 75
  Content-Type: application/json;charset=utf-8
  Date: Tue, 19 Aug 2025 18:37:43 GMT
  Server: Caddy
  X-Content-Type-Options: nosniff
  X-Frame-Options: SAMEORIGIN

Username/Password Authentication Failed.

From what I can see the response sent to the user is neither 75 bytes long nor JSON. That makes the sent headers inconsistent with sent data

Gitea Version

1.25.0+dev-383-g463016b317

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Database

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/needs-feedbackFor bugs, we need more details. For features, the feature must be described in more detailissue/not-a-bugThe reported issue is the intended behavior or the problem is not inside Gitea

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions