Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Remove ASSET_HOST for Static #11801

Merged
merged 1 commit into from
Sep 6, 2022
Merged

Conversation

theseanything
Copy link
Contributor

By removing ASSET_HOST assets URLs and compiled asset URLs (e.g. in
css) will become relative. This works as assets are served from the same
domain in production (however with the path prefix /assets/static/*).

Having ASSET_HOST set and using absolute URLs prevents us creating re-usable
container images, as the assets URLs are environment dependent.

We set ASSET_HOST for Static so that local development and heroku
deployments can send requests to Static hosted in Production, instead of
running a local version. However, this problem can be solved by proxing
requests via the frontend app.

@theseanything theseanything marked this pull request as ready for review September 1, 2022 10:32
theseanything added a commit to alphagov/collections that referenced this pull request Sep 1, 2022
This sets the GOVUK_PROXY_STATIC_URL env var to enable the proxy to Static in production. This is so the application continues, when Static changes to use relative URLs for assets. See alphagov/govuk_app_config#261 and alphagov/govuk-puppet#11801
theseanything added a commit to alphagov/collections that referenced this pull request Sep 1, 2022
This sets the GOVUK_PROXY_STATIC_ENABLED env var to enable the proxy to
Static in production. This is so the application continues, when Static
changes to use relative URLs for assets. See
alphagov/govuk_app_config#261 and
alphagov/govuk-puppet#11801
theseanything added a commit to alphagov/finder-frontend that referenced this pull request Sep 1, 2022
This sets the GOVUK_PROXY_STATIC_ENABLED env var to enable the proxy to
Static in production. This is so the application continues, when Static
changes to use relative URLs for assets. See
alphagov/govuk_app_config#261 and
alphagov/govuk-puppet#11801
theseanything added a commit to alphagov/frontend that referenced this pull request Sep 1, 2022
This sets the GOVUK_PROXY_STATIC_ENABLED env var to enable the proxy to
Static in production. This is so the application continues, when Static
changes to use relative URLs for assets. See
alphagov/govuk_app_config#261 and
alphagov/govuk-puppet#11801
theseanything added a commit to alphagov/government-frontend that referenced this pull request Sep 1, 2022
This sets the GOVUK_PROXY_STATIC_ENABLED env var to enable the proxy to
Static in production. This is so the application continues, when Static
changes to use relative URLs for assets. See
alphagov/govuk_app_config#261 and
alphagov/govuk-puppet#11801
theseanything added a commit to alphagov/info-frontend that referenced this pull request Sep 1, 2022
This sets the GOVUK_PROXY_STATIC_ENABLED env var to enable the proxy to
Static in production. This is so the application continues, when Static
changes to use relative URLs for assets. See
alphagov/govuk_app_config#261 and
alphagov/govuk-puppet#11801
theseanything added a commit to alphagov/licence-finder that referenced this pull request Sep 1, 2022
This sets the GOVUK_PROXY_STATIC_ENABLED env var to enable the proxy to
Static in production. This is so the application continues, when Static
changes to use relative URLs for assets. See
alphagov/govuk_app_config#261 and
alphagov/govuk-puppet#11801
theseanything added a commit to alphagov/service-manual-frontend that referenced this pull request Sep 1, 2022
This sets the GOVUK_PROXY_STATIC_ENABLED env var to enable the proxy to
Static in production. This is so the application continues, when Static
changes to use relative URLs for assets. See
alphagov/govuk_app_config#261 and
alphagov/govuk-puppet#11801
theseanything added a commit to alphagov/smart-answers that referenced this pull request Sep 1, 2022
This sets the GOVUK_PROXY_STATIC_ENABLED env var to enable the proxy to
Static in production. This is so the application continues, when Static
changes to use relative URLs for assets. See
alphagov/govuk_app_config#261 and
alphagov/govuk-puppet#11801
theseanything added a commit to alphagov/govuk-docker that referenced this pull request Sep 1, 2022
This sets the GOVUK_PROXY_STATIC_ENABLED env var to enable the proxy to
Static in production. This is so the application continues, when Static
changes to use relative URLs for assets. See
alphagov/govuk_app_config#261 and
alphagov/govuk-puppet#11801
By removing ASSET_HOST assets URLs and compiled asset URLs (e.g. in
css) will become relative. This works as assets are served from the same
domain in production (however with the path prefix /assets/static/*).

Having ASSET_HOST set and using absolute URLs prevents us creating re-usable
container images, as the assets URLs are environment dependent.

We set ASSET_HOST for Static so that local development and heroku
deployments can send requests to Static hosted in Production, instead of
running a local version. However, this problem can be solved by proxing
requests via the frontend app.
Copy link
Contributor

@sengi sengi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love that it's pure deletions! Awesome :D

@theseanything theseanything merged commit d6f9b19 into main Sep 6, 2022
@theseanything theseanything deleted the remove-asset-host-for-static branch September 6, 2022 15:15
@sengi
Copy link
Contributor

sengi commented Sep 30, 2022

Turns out this was a load-bearing piece of tech debt 😭🤣🙈

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants