HTML output in API Responses with ENABLE_GZIP #3715

Closed
opened 2025-11-02 05:22:47 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @lystor on GitHub (Aug 2, 2019).

  • Gitea version: 1.9.0
  • Operating system: official Docker image gitea/gitea:1.9.0
  • Database (use [x]):
    • SQLite

Description

Hello

With enabled GZIP compression Gitea adds HTML rendered page after JSON response.

Example:

$ curl -X GET "http://localhost/api/v1/orgs/xxx" -H "accept: application/json" -H "authorization: Basic ZnJhZzpmcmFn"

{"documentation_url":"http://localhost:3000/api/swagger","errors":null,"message":"Not Found"}
<!DOCTYPE html>
<html lang="en-US">
<head data-suburl="">
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="x-ua-compatible" content="ie=edge">
	<title>Internal Server Error -  Gitea: Git with a cup of tea</title>
	<link rel="manifest" href="/manifest.json" crossorigin="use-credentials">
...

app.ini:

APP_NAME = Gitea: Git with a cup of tea
RUN_MODE = prod
RUN_USER = git

[repository]
ROOT = /data/git/repositories

[repository.local]
LOCAL_COPY_PATH = /data/gitea/tmp/local-repo

[repository.upload]
TEMP_PATH = /data/gitea/uploads

[server]
ENABLE_GZIP      = true
APP_DATA_PATH    = /data/gitea
SSH_DOMAIN       = localhost
HTTP_PORT        = 3000
ROOT_URL         = http://localhost:3000/
DISABLE_SSH      = false
SSH_PORT         = 22
LFS_START_SERVER = true
LFS_CONTENT_PATH = /data/git/lfs
DOMAIN           = localhost
LFS_JWT_SECRET   = v4Zc5M9iJBGQrwHehx7hwESS4BcCrr0U1imKq-RDJV4
OFFLINE_MODE     = false

[database]
PATH     = /data/gitea/gitea.db
DB_TYPE  = sqlite3
HOST     = localhost:3306
NAME     = gitea
USER     = root
PASSWD   =
SSL_MODE = disable
CHARSET  = utf8

[indexer]
ISSUE_INDEXER_PATH = /data/gitea/indexers/issues.bleve

[session]
PROVIDER_CONFIG = /data/gitea/sessions
PROVIDER        = file

[picture]
AVATAR_UPLOAD_PATH            = /data/gitea/avatars
REPOSITORY_AVATAR_UPLOAD_PATH = /data/gitea/repo-avatars
DISABLE_GRAVATAR              = false
ENABLE_FEDERATED_AVATAR       = true

[attachment]
PATH = /data/gitea/attachments

[log]
ROOT_PATH = /data/gitea/log
MODE      = file
LEVEL     = info

[security]
INSTALL_LOCK   = true
SECRET_KEY     = fG84S9WOKdGg4XkEIokaV7pfzKxjEZb0A4vipQts1QnWKsK7oCjL36OMEM1WmLFZ
INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1NjQ3MzY2NTh9.WO3Ly5BSw-BgbnlerAOY0l8RqTjNsy0wKr6bwPC-V4Q

[service]
DISABLE_REGISTRATION              = false
REQUIRE_SIGNIN_VIEW               = false
REGISTER_EMAIL_CONFIRM            = false
ENABLE_NOTIFY_MAIL                = false
ALLOW_ONLY_EXTERNAL_REGISTRATION  = false
ENABLE_CAPTCHA                    = false
DEFAULT_KEEP_EMAIL_PRIVATE        = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING       = true
NO_REPLY_ADDRESS                  = noreply.example.org

[oauth2]
JWT_SECRET = nKYwg2CFn6XvyjvqO-ezrvxb9Zw8BxTJ6oAafSguIec

[mailer]
ENABLED = false

[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = true

Please fix this bug.
Thank you

Originally created by @lystor on GitHub (Aug 2, 2019). - Gitea version: 1.9.0 - Operating system: official Docker image gitea/gitea:1.9.0 - Database (use `[x]`): - [x] SQLite ## Description Hello With enabled GZIP compression Gitea adds HTML rendered page after JSON response. Example: ``` $ curl -X GET "http://localhost/api/v1/orgs/xxx" -H "accept: application/json" -H "authorization: Basic ZnJhZzpmcmFn" {"documentation_url":"http://localhost:3000/api/swagger","errors":null,"message":"Not Found"} <!DOCTYPE html> <html lang="en-US"> <head data-suburl=""> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>Internal Server Error - Gitea: Git with a cup of tea</title> <link rel="manifest" href="/manifest.json" crossorigin="use-credentials"> ... ``` app.ini: ``` APP_NAME = Gitea: Git with a cup of tea RUN_MODE = prod RUN_USER = git [repository] ROOT = /data/git/repositories [repository.local] LOCAL_COPY_PATH = /data/gitea/tmp/local-repo [repository.upload] TEMP_PATH = /data/gitea/uploads [server] ENABLE_GZIP = true APP_DATA_PATH = /data/gitea SSH_DOMAIN = localhost HTTP_PORT = 3000 ROOT_URL = http://localhost:3000/ DISABLE_SSH = false SSH_PORT = 22 LFS_START_SERVER = true LFS_CONTENT_PATH = /data/git/lfs DOMAIN = localhost LFS_JWT_SECRET = v4Zc5M9iJBGQrwHehx7hwESS4BcCrr0U1imKq-RDJV4 OFFLINE_MODE = false [database] PATH = /data/gitea/gitea.db DB_TYPE = sqlite3 HOST = localhost:3306 NAME = gitea USER = root PASSWD = SSL_MODE = disable CHARSET = utf8 [indexer] ISSUE_INDEXER_PATH = /data/gitea/indexers/issues.bleve [session] PROVIDER_CONFIG = /data/gitea/sessions PROVIDER = file [picture] AVATAR_UPLOAD_PATH = /data/gitea/avatars REPOSITORY_AVATAR_UPLOAD_PATH = /data/gitea/repo-avatars DISABLE_GRAVATAR = false ENABLE_FEDERATED_AVATAR = true [attachment] PATH = /data/gitea/attachments [log] ROOT_PATH = /data/gitea/log MODE = file LEVEL = info [security] INSTALL_LOCK = true SECRET_KEY = fG84S9WOKdGg4XkEIokaV7pfzKxjEZb0A4vipQts1QnWKsK7oCjL36OMEM1WmLFZ INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1NjQ3MzY2NTh9.WO3Ly5BSw-BgbnlerAOY0l8RqTjNsy0wKr6bwPC-V4Q [service] DISABLE_REGISTRATION = false REQUIRE_SIGNIN_VIEW = false REGISTER_EMAIL_CONFIRM = false ENABLE_NOTIFY_MAIL = false ALLOW_ONLY_EXTERNAL_REGISTRATION = false ENABLE_CAPTCHA = false DEFAULT_KEEP_EMAIL_PRIVATE = false DEFAULT_ALLOW_CREATE_ORGANIZATION = true DEFAULT_ENABLE_TIMETRACKING = true NO_REPLY_ADDRESS = noreply.example.org [oauth2] JWT_SECRET = nKYwg2CFn6XvyjvqO-ezrvxb9Zw8BxTJ6oAafSguIec [mailer] ENABLED = false [openid] ENABLE_OPENID_SIGNIN = true ENABLE_OPENID_SIGNUP = true ``` Please fix this bug. Thank you
GiteaMirror added the issue/needs-feedbacktype/bug labels 2025-11-02 05:22:47 -06:00
Author
Owner

@zeripath commented on GitHub (Aug 2, 2019):

We need the log information too.

@zeripath commented on GitHub (Aug 2, 2019): We need the log information too.
Author
Owner

@stale[bot] commented on GitHub (Oct 2, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Oct 2, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@zeripath commented on GitHub (Oct 11, 2019):

I can't reproduce this on master. @lystor does this still happen? Do you have any logs?

@zeripath commented on GitHub (Oct 11, 2019): I can't reproduce this on master. @lystor does this still happen? Do you have any logs?
Author
Owner

@zeripath commented on GitHub (Nov 21, 2019):

I think this is the same problem as #9001 and it's fixed similarly.

@zeripath commented on GitHub (Nov 21, 2019): I think this is the same problem as #9001 and it's fixed similarly.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3715