FortAwesome / font-awesome-sass

Font-Awesome Sass gem for use in Ruby/Rails projects
MIT License
911 stars 266 forks source link

problem in production env with sub-URI deployed application #40

Open adas172002 opened 10 years ago

adas172002 commented 10 years ago

Hi,

Rails 4.1.4 app running on Passenger/ apache in sub-URI /svt. Using font-awesome-sass gem in development env works as expected, but after deploying to production enviroment FA fonts do not show up. Apache access log gives possible explanation of the issue:

10.42.48.23 - - [12/Aug/2014:19:41:55 +0200] "GET /svt/production_lines/1 HTTP/1.1" 200 10906 "http://webapps/svt/production_lines" "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko" 10.42.48.23 - - [12/Aug/2014:19:41:56 +0200] "GET /svt/assets/vendor/modernizr-390c3ba023eee60e63844f663c6ab0c1.js HTTP/1.1" 200 11084 "http://webapps/svt/production_lines/1" "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko" 10.42.48.23 - - [12/Aug/2014:19:41:56 +0200] "GET /svt/assets/application-a6a75ba39ebd44418ebaaccada0d169a.css HTTP/1.1" 200 148051 "http://webapps/svt/production_lines/1" "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko" 10.42.48.23 - - [12/Aug/2014:19:41:56 +0200] "GET /svt/assets/application-072034d42842308dc466b38fadbfebb9.js HTTP/1.1" 200 196950 "http://webapps/svt/production_lines/1" "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko" 10.42.48.23 - - [12/Aug/2014:19:41:57 +0200] "GET /assets/fontawesome-webfont-193779f97a012b987d59a85827509b89.eot? HTTP/1.1" 404 1351 "http://webapps/svt/production_lines/1" "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko" 10.42.48.23 - - [12/Aug/2014:19:41:57 +0200] "GET /assets/fontawesome-webfont-8256e2389e155e0b32d94d9afacdf5e6.woff?v=4.1.0 HTTP/1.1" 404 1351 "http://webapps/svt/production_lines/1" "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko" 10.42.48.23 - - [12/Aug/2014:19:41:57 +0200] "GET /assets/fontawesome-webfont-b3884e8c99f97377e242bc01a2aebfd6.ttf?v=4.1.0 HTTP/1.1" 404 1351 "http://webapps/svt/production_lines/1" "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko"

As you see, font files are 404s because are looked up in root directory of the server, while they should be referenced with subdirectory, like stylesheets files.

For the reference, public/assets/ directory contains font files, generated with sprockets bundle exec rake assets:precompile RAILS_ENV=production

ldonnet commented 10 years ago

Hi,

Is someone try to fix this bug with assets? Or do you find a workaround @adas172002 ?

Best Regards Luc Donnet

adas172002 commented 10 years ago

Hi Luc,

looks like my bug is unresolved. In fact I am not sure if this a font awesome or Sprockets bug. In the meantime I updated FA to 4.2.0 and also Rails to 4.1.6, sass.gem is 3.2.19 - there is a dependency from foundation-rails.gem I am using in my project.

Anyway, I made links on server in main app public/assets to point font resources from sub-URI assets directory. This works for me, YMMV.