Icons URLs incorrect when base URL is changed
We are currently testing Foreman 1.11.2 and we found out that the icons are not correctly displayed anymore, as you can see in the attached picture.
It seems that icons URLs are incorrect when under a different base URL. (here we have https://foo.bar/foreman/)
It seems similar to this old issue:
Thank you for your help,
#1 Updated by Dominic Cleal over 4 years ago
- Category set to Web Interface
If you're using our packages with their precompiled assets, I don't know if this is easily fixable as I think it would usually require the assets to be precompiled with the appropriate prefix.
Our packages are obviously precompiled with the default / prefix - so to recompile them you'd do something like: install foreman-assets, run
foreman-rake assets:precompile RAILS_RELATIVE_URL_ROOT=/foreman
When using the installer to set up a non-default prefix, the VirtualHost is usually still configured to point to ~foreman/public/ as the document root, so requesting /assets/* still works, while the Passenger app is only loaded at /foreman/. Doing this or something similar (e.g. aliasing /assets) may be the best way to make it work without rebuilding assets.
#2 Updated by Thomas Saquet over 4 years ago
Thank you for your quick answer.
Our first test recompiling is a failure since our server is not thought to compile Foreman:
foreman@foreman:~$ RAILS_ENV=production ./bin/rake assets:precompile RAILS_RELATIVE_URL_ROOT=/foreman rake aborted! LoadError: cannot load such file -- uglifier /usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-220.127.116.11/lib/active_support/dependencies.rb:247:in `require' /usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-18.104.22.168/lib/active_support/dependencies.rb:247:in `block in require' /usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-22.214.171.124/lib/active_support/dependencies.rb:232:in `load_dependency' /usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-126.96.36.199/lib/active_support/dependencies.rb:247:in `require' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/autoload/uglifier.rb:1:in `<top (required)>' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/uglifier_compressor.rb:39:in `initialize' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/uglifier_compressor.rb:24:in `new' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/uglifier_compressor.rb:24:in `instance' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/uglifier_compressor.rb:28:in `call' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/processor_utils.rb:75:in `call_processor' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/processor_utils.rb:57:in `block in call_processors' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/processor_utils.rb:56:in `reverse_each' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/processor_utils.rb:56:in `call_processors' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/loader.rb:134:in `load_from_unloaded' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/loader.rb:60:in `block in load' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/loader.rb:44:in `load' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/cached_environment.rb:20:in `block in initialize' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/cached_environment.rb:47:in `yield' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/cached_environment.rb:47:in `load' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/base.rb:66:in `find_asset' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/base.rb:73:in `find_all_linked_assets' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/manifest.rb:134:in `block in find' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/manifest.rb:133:in `each' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/manifest.rb:133:in `find' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/sprockets/manifest.rb:185:in `compile' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-3.6.0/lib/rake/sprocketstask.rb:147:in `with_logger' /usr/share/foreman/vendor/ruby/2.1.0/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define' Tasks: TOP => assets:precompile (See full trace by running task with --trace)
We are not in the case you mention at the end of your message, we are behind a reverse proxy and only url finishing with /foreman are redirected to the server. (We can try to hack this but it might conflict with some other service)
If this could be setted in the parameters, it would be perfect. Can we imagine such a thing?
#4 Updated by Thomas Saquet over 4 years ago
We missed the installation part of your previous message. It works :)
Thank you for your help!
Could I have found this by myself? I do not see it in the documentation. It might be interesting to add this to the documentation to upgrade to 1.10 & 1.11.
#5 Updated by Dominic Cleal over 4 years ago
Glad it works, I'll leave the ticket open though in case it's possible to fix in a better manner in the future.
We only document precompilation of assets for source installations where it's absolutely necessary, it could be added as an advanced/specific topic for packages in this case.