Content
installation in http-subdirectory: compiled css assets contain wrong url
Added by Jonas Küpper over 10 years ago
hi,
i have installed openproject on a CentOS server in /home/openproject/openproject to be served via apache/passenger in a subdirectory like this: http://1.2.3.4/openproject
with a litlle fiddling i made it work with the suggestions from https://www.openproject.org/topics/1340 and https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#deploying_rack_to_sub_uri.
This let me run openproject through the subdirectory, however the generated css files contain wrong paths to the web assets like fonts and images. For example
default-[HASH].css is correctly loaded through http://1.2.3.4/openproject/assets/default-[HASH].css
but it contains this CSS:
@font-face{ font-family:"LatoLight"; src:url(/assets/lato/Lato-Lig-webfont-ce304c9c1de225bd631232a7050644b9.eot); src: url(/assets/lato/Lato-Lig-webfont.eot?#iefix) format("embedded-opentype"), url(/assets/lato/Lato-Lig-webfont-91b91c476db37a67760fa2947f741196.ttf) format("truetype"), url(/assets/lato/Lato-Lig-webfont.svg#untitled-font-1) format("svg"), url(/assets/lato/Lato-Lig-webfont-8da994d0cd00558a03e543da3bec79d7.woff) format("woff"); font-weight:normal; font-style:normal}
where it would map to http://1.2.3.4/assets/lato/Lato-Lig-webfont.eot?#iefix
which does not exist.
with a subdirectory deployment this should either be a relative URL like url(lato/Lato-Lig-webfont-ce304c9c1de225bd631232a7050644b9.eot)
or url(/openproject/assets/lato/Lato-Lig-webfont-ce304c9c1de225bd631232a7050644b9.eot)
.
for my first try i hadn’t set rails_relative_url_root: "/openproject"
in configuration.yml but even after i changed the config and executed RAILS_ENV="production" bundle exec rake assets:precompile
that didn’t change. i even moved the whole public/assets
-folder somewhere else and let it recompile, to no avail.
I managed to fix it by setting an alias in the apache config:
Alias /assets /home/openproject/openproject/public/assets
but i rather would see openproject to be contained in the http://1.2.3.4/openproject
-subdirectory
do i miss something here? is there any way to fix the paths during css compilation??
Replies (3)
Hello Jonas,
it should be enough to set
rails_relative_url_root
in configuration.yml before you precompile the assets and set thePassengerBaseURI
in your apache config.Do you run the latest stable version (3.0.8) of OpenProject?
Best
Ratzi
yes its openproject 3.0.8 (checked out two days ago). as i said, i already set that variable. why would the apache config have influence on the compiling of the assets?
anyway, i just did that:
So no change.
i even tried to move the assets folder out of the way, no success:
As the modification time of the css files do not change i guess they are simply copied from somewhere without processing?
Hi
I think Ratzi just supplied the answer in
https://www.openproject.org/topics/1340
the change should be
rails_relative_url_root: “/public”
I just removed the work around and tested it and it worked
:)
have updated my doco
thanks Ratzi