gogs icon indicating copy to clipboard operation
gogs copied to clipboard

Use user request 'Host' replace `conf.Server.ExternalURL` in `internal/route/lfs /batch.go`

Open whtiehack opened this issue 1 year ago • 0 comments

Describe the feature

Because gogs may be reverse proxied, accessed by IP address on an internal network, or accessed by multiple different domain names on an external network.

Therefore, these access methods will directly return the conf.Server.ExternalURL address when using LFS.

https://github.com/gogs/gogs/blob/c8cd3e712519c1361b8ee47357ee9e2c777c8179/internal/route/lfs/batch.go#L37


This will cause two problems:

  1. When pulling lfs objects, it will prompt for login again.

  2. When the ExternalURL is configured as an internal IP, accessing the domain name from external network will return the configured internal IP when pulling LFS objects.

Describe the solution you'd like

https://github.com/gogs/gogs/blob/c8cd3e712519c1361b8ee47357ee9e2c777c8179/internal/route/lfs/batch.go#L37

Replace conf.Server.ExternalURL with Host in the user's request.

Describe alternatives you've considered

None

Additional context

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

whtiehack avatar May 09 '24 04:05 whtiehack