Documentation
¶
Overview ¶
Package baseurl resolves the public base URL a response must embed.
npm tarball links, Helm chart URLs, the NuGet service index, Terraform download URLs, Docker upload locations and file-info URIs all carry absolute URLs. Behind a reverse proxy the request's own host is wrong, so the resolver follows Artifactory's precedence (OSS 6.20 HttpUtils.getServletContextUrl, research 17): the X-JFrog-Override-Base-Url header, then the configured base URL, then the X-Forwarded-* headers, then the request. A configured base URL is the operator naming the public URL, so a request header the operator does not control never overrides it (#313). Every handler reads the result from the context so there is exactly one place that implements the rule (decision 0002).
Index ¶
Constants ¶
const OverrideHeader = "X-JFrog-Override-Base-Url"
OverrideHeader is the header Artifactory clients and proxies use to force the base URL for one request.
Variables ¶
This section is empty.
Functions ¶
func ForwardedHost ¶
ForwardedHost is the host the client addressed as the outermost proxy saw it: the first entry of X-Forwarded-Host, or "" when there is none. Each proxy in a chain appends the host it received, so the first entry is the client-facing one and later entries are internal (research 17). An empty first entry names no host, so it is ignored rather than trusting a later, internal one.
func From ¶
From returns the base URL stored by Middleware, or "" when the middleware did not run. Callers treat "" as a programming error, not a fallback.
func Middleware ¶
Middleware stores the resolved base URL in the request context.
Types ¶
This section is empty.