Allow specifying application root path via the environment #76
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
LineageOTA needs to know the full external URL to itself in order to generate correct links in the JSON emitted by the
/api
endpoint.In typical circumstances, no manual configuration is necessary - it is able to infer it from the URL that it is accessed by, or from the
Forwarded
header, or from thero.build.ota.url
property from.prop
files. However, when it is running behind a reverse proxy (and in the absence of the.ota.url
property) , the URL prefix is not available to LineageOTA, so unless it matches the prefix on the local webserver, it is unable to construct a correct URL to itself in this scenario.To allow it to do so, a mechanism must be added to provide this information to it. There are two straight-forward approaches:
Provide this information externally, i.e. using a configuration file or an environment variable
Provide this information in an HTTP header, in the same manner as the
Forwarded
header.In this pull request, the former method is implemented. The rationale for not using the latter method is that administrators would need to be aware of this change and override or block the header in their reverse proxy configuration, to prevent it being forwarded (and thus spoofed).
Fixes #75.