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

[feat] introduce rawgit registry, cross origin resource sharing repo/raw/branch/main/file #33216

Open
loynoir opened this issue Jan 11, 2025 · 1 comment
Labels

Comments

@loynoir
Copy link

loynoir commented Jan 11, 2025

Description

BUG

repository.ACCESS_CONTROL_ALLOW_ORIGIN is not working

reproduce

Gitea access-control-allow-origin defaults to disabled.

$ (curl -v -H 'Origin: https://example.com' https://${GITEA}/api/v1/version > /dev/null) |& grep access-control-allow-origin
(empty)

According to https://docs.gitea.com/administration/config-cheat-sheet

With docker compose env config

      GITEA__cors__ENABLED: true
      GITEA__cors__ALLOW_DOMAIN: "*"
      GITEA__repository__ACCESS_CONTROL_ALLOW_ORIGIN: "*"

Manually confirm app.ini contains everything below

[repository]
ACCESS_CONTROL_ALLOW_ORIGIN = *

[cors]
ALLOW_DOMAIN = *
ENABLED = true

Gitea access-control-allow-origin now working within gitea api.

$ (curl -v -H 'Origin: https://example.com' https://${GITEA}/api/v1/version > /dev/null) |& grep access-control-allow-origin
< access-control-allow-origin: *

Until now, things are all expected.

actual

Gitea access-control-allow-origin not working within gitea repository.

$ (curl -v -H 'Origin: https://example.com' https://${GITEA}/${OWNER}/${REPO}/raw/branch/main/package.json > /dev/null) |& grep access-control-allow-origin
(empty)

expected

Gitea access-control-allow-origin working within gitea repository.

$ (curl -v -H 'Origin: https://example.com' https://${GITEA}/${OWNER}/${REPO}/raw/branch/main/package.json > /dev/null) |& grep access-control-allow-origin
< access-control-allow-origin: *

Gitea Version

Powered by Gitea Version: 1.23.1

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?

docker gitea 1.23.1

Database

None

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Jan 11, 2025

It was only designed for these paths:

image

@loynoir loynoir changed the title repository.ACCESS_CONTROL_ALLOW_ORIGIN is not working repository.ACCESS_CONTROL_ALLOW_ORIGIN is not working for {{repo}}/raw/branch/main/{{file}} Jan 11, 2025
@loynoir loynoir changed the title repository.ACCESS_CONTROL_ALLOW_ORIGIN is not working for {{repo}}/raw/branch/main/{{file}} [feat] repository.ACCESS_CONTROL_ALLOW_ORIGIN working with {{repo}}/raw/branch/main/{{file}} Jan 11, 2025
@loynoir loynoir changed the title [feat] repository.ACCESS_CONTROL_ALLOW_ORIGIN working with {{repo}}/raw/branch/main/{{file}} [feat] repository.ACCESS_CONTROL_ALLOW_ORIGIN should working with {{repo}}/raw/branch/main/{{file}} Jan 11, 2025
@loynoir loynoir changed the title [feat] repository.ACCESS_CONTROL_ALLOW_ORIGIN should working with {{repo}}/raw/branch/main/{{file}} [feat] introduce rawgit registry, cross origin resource sharing repo/raw/branch/main/file Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants