mirror of
https://gitea.com/gitea/runner.git
synced 2026-11-07 15:50:28 +00:00
enhance(runner): add extra HTTP headers (#1269)
Add `runner.extra_headers` for reverse proxies that require request headers on the runner's API requests to Gitea, like registration, polling and log and status reports. Headers the runner sets itself (authentication, User-Agent, protocol headers) stay authoritative. Extra headers are dropped when a redirect changes the hostname or leaves HTTPS, while the runner's own authentication headers follow redirects as before. Invalid or case-insensitively duplicated header names are rejected at config load. Fixes: https://gitea.com/gitea/runner/issues/171 Co-authored-by: silverwind <[email protected]> Reviewed-on: https://gitea.com/gitea/runner/pulls/1269 Co-authored-by: bircni <[email protected]>
This commit is contained in:
1 parent
3802feb3fe
commit
ff30f39b1b
8 files changed
+131
-11
No files matched your search
@@ -174,6 +174,7 @@ func runDaemon(ctx context.Context, daemArgs *daemonArgs, configFile *string) fu
|
||||
reg.UUID,
|
||||
reg.Token,
|
||||
config.RequestTimeout,
|
||||
cfg.Runner.ExtraHeaders,
|
||||
)
|
||||
|
||||
runner := run.NewRunner(cfg, reg, cli)
|
||||
|
||||
@@ -367,6 +367,7 @@ func doRegister(ctx context.Context, cfg *config.Config, inputs *registerInputs)
|
||||
"",
|
||||
"",
|
||||
config.RequestTimeout,
|
||||
cfg.Runner.ExtraHeaders,
|
||||
)
|
||||
|
||||
if _, err := cli.Ping(ctx, connect.NewRequest(&pingv1.PingRequest{
|
||||
|
||||
Reference in new issue
Block a user