Bug #15481
openIcons URLs incorrect when base URL is changed
Description
Hello,
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/)
For instance:
GET https://foo.bar/assets/bootstrap/glyphicons-halflings-regular-a26394f7ede100ca118eff2eda08596275a9839b959c226e15439557a5a80742.woff
Instead of:
GET https://foo.bar/foreman/assets/bootstrap/glyphicons-halflings-regular-a26394f7ede100ca118eff2eda08596275a9839b959c226e15439557a5a80742.woff
It seems similar to this old issue:
http://projects.theforeman.org/issues/2646
Thank you for your help,
Regards,
Thomas
Files
Updated by Dominic Cleal over 8 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.
Updated by Thomas Saquet over 8 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-4.1.14.2/lib/active_support/dependencies.rb:247:in `require' /usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-4.1.14.2/lib/active_support/dependencies.rb:247:in `block in require' /usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-4.1.14.2/lib/active_support/dependencies.rb:232:in `load_dependency' /usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-4.1.14.2/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?
Thank you,
Regards,
Thomas
Updated by Dominic Cleal over 8 years ago
Did you install the foreman-assets package?
Updated by Thomas Saquet over 8 years ago
Oh. Nope.
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.
Updated by Dominic Cleal over 8 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.