A GITLAB_CDN_HOST setting which does not begin with http:// causes unexpected behavior
If a GITLAB_CDN_HOST or config.action_controller.asset_host setting is used which is not prefixed with http:// or https://, it can result in broken asset URLs. Although Sprockets handles this well when generating asset paths (it infers the scheme as http when none is provided), much of the code written around this setting does not take into account that asset_host could be something like mydomain.com:8000. Similar issues can come up if this value ends with a trailing slash / as much of the code that uses this will add one when generating a URL.
To remedy this, we ought to:
- Produce warnings when this environment variable doesn't match the expected format (perhaps just fail to start up in this case)
- Or we should put some additional logic into
config/environments/production.rbwhich normalizes this value by auto-prefixing the scheme where necessary (defaulting tohttp://) and ensuring it does not end with a trailing slash.
Edited by Mike Greiling