# Rails, passenger, and images

**URL:** <https://www.ruby-forum.com/t/rails-passenger-and-images/162796>\
**Category:** Rails\
**Created:** [March 13, 2009, 9:02pm UTC](https://www.ruby-forum.com/t/rails-passenger-and-images/162796 "2009-03-13T21:02:13Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![steveoco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/db5fbb/32.png) [@steveoco](https://www.ruby-forum.com/u/steveoco)\
**Post date:** [March 13, 2009, 9:02pm UTC](https://www.ruby-forum.com/t/rails-passenger-and-images/162796/1 "2009-03-13T21:02:13Z")

</div>

Just switched over to passenger for development and production for my  
rails app. Liking it so far.

My problem is my image\_links, stylesheet\_tag\_links, and  
javascript\_tag\_links are all adding "[http://localhost:3000](http://localhost:3000) to the  
generated links. I got around the stylesheet and js links by not using  
the helpers.

I can access my all of my assets directly via  
[http://dating.local/stylesheets/all.css](http://dating.local/stylesheets/all.css),  
for example.

I used passenger pref pane to render the vhost. It looks like:  
\<VirtualHost \*:80\>  
ServerName dating.local  
DocumentRoot “/Users/steveodom/Development/dating/public”  
RailsEnv development  
\<directory “/Users/steveodom/Development/dating/public”\>  
Order allow,deny  
Allow from all  
  
ErrorLog “/Users/steveodom/Development/dating/log/apache.log”

I’m not getting any errors in my development.log or apache error\_log

Everything should be standard. I’ve experimented with ProxyPass’s but  
those didn’t help.

I’m using passenger 2.0.6, rails 2.2.2

Any suggestions?

Thanks,  
Steve

---

<div class="post-metadata">

**Author:** ![steveoco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/db5fbb/32.png) [@steveoco](https://www.ruby-forum.com/u/steveoco)\
**Post date:** [March 13, 2009, 9:12pm UTC](https://www.ruby-forum.com/t/rails-passenger-and-images/162796/2 "2009-03-13T21:12:46Z")

</div>

look into apache access\_log, if there any regular requests to the  
js/image/css files…

I’m using passenger too without any problems…

tom

Steve O. wrote:

> Thanks, Steve

# –

Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache

# [www.meinlschmidt.com](http://www.meinlschmidt.com) www.maxwellrender.cz www.lightgems.cz

---

<div class="post-metadata">

**Author:** ![steveoco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/db5fbb/32.png) [@steveoco](https://www.ruby-forum.com/u/steveoco)\
**Post date:** [March 13, 2009, 9:14pm UTC](https://www.ruby-forum.com/t/rails-passenger-and-images/162796/3 "2009-03-13T21:14:32Z")

</div>

On Fri, Mar 13, 2009 at 1:01 PM, Steve O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> [http://dating.local/stylesheets/all.css](http://dating.local/stylesheets/all.css),  
>   
> Any suggestions?
> 
> Thanks,  
> Steve

Steve, do you have the following line in your vhosts file:

NameVirtualHost \*:80

Also, did you add an entry in your /etc/hosts file to contain the  
following:

127.0.0.1 dating.local

Last but not least, did you stop Mongrel, Webrick, or Thin?

-Conrad

---

<div class="post-metadata">

**Author:** ![steveoco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/db5fbb/32.png) [@steveoco](https://www.ruby-forum.com/u/steveoco)\
**Post date:** [March 13, 2009, 9:50pm UTC](https://www.ruby-forum.com/t/rails-passenger-and-images/162796/4 "2009-03-13T21:50:53Z")

</div>

There are not any requests for my images showing up in my apache  
access\_log where I use an image\_tag. If I handroll the image ref  
like:

![](https://www.ruby-forum.com/images/icons/add.gif)

then it shows up fine. But if I use the image\_tag helper like:

\<%= image\_tag “icons/add.gif” %\>

…it gets rendered like:  
 ![Add](http://localhost:3000/images/icons/add.gif?%0A1221425550)

…and is broken as a result.

My stylesheet and js requests show up because I’m not using the rails  
helpers (stylesheet\_tag\_link).

I used preference pane to set it up. I was under the impression I did  
not have to add an entry in my /etc/hosts file.

This is a new macbook where I havent used webrick, mongrel, or thin.

Any ideas?

Steve

---

<div class="post-metadata">

**Author:** ![steveoco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/db5fbb/32.png) [@steveoco](https://www.ruby-forum.com/u/steveoco)\
**Post date:** [March 14, 2009, 3:15pm UTC](https://www.ruby-forum.com/t/rails-passenger-and-images/162796/5 "2009-03-14T15:15:11Z")

</div>

Well, how bout that. It was the facebooker plugin taking control of  
asset\_host. Only appears to be a problem while running passenger.

Thanks for the pointer Brian.

Steve

---

<div class="post-metadata">

**Author:** ![steveoco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/db5fbb/32.png) [@steveoco](https://www.ruby-forum.com/u/steveoco)\
**Post date:** [March 13, 2009, 10:01pm UTC](https://www.ruby-forum.com/t/rails-passenger-and-images/162796/6 "2009-03-13T22:01:25Z")

</div>

Check your app’s source. Look for anything dealing with asset\_host. My  
guess is something is prepending this to your image helper, and  
asset\_host will do that if you tell it to.

If you create a new Rails app, you’ll be able to test this out by  
making a controller and a view. On the view, just link to the  
rails.png image in the /images folder that ships with a defalt app.

\<%=image\_tag “rails.png” %\>

If that gives you trouble, then it’s not your code.

HTH

---

<div class="post-metadata">

**Author:** ![steveoco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/db5fbb/32.png) [@steveoco](https://www.ruby-forum.com/u/steveoco)\
**Post date:** [March 14, 2009, 4:36pm UTC](https://www.ruby-forum.com/t/rails-passenger-and-images/162796/7 "2009-03-14T16:36:05Z")

</div>

@Steve:

Awesome!

---

<div class="post-metadata">

**Author:** ![steveoco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/db5fbb/32.png) [@steveoco](https://www.ruby-forum.com/u/steveoco)\
**Post date:** [March 15, 2009, 4:46pm UTC](https://www.ruby-forum.com/t/rails-passenger-and-images/162796/8 "2009-03-15T16:46:34Z")

</div>

> Well, how bout that. It was the facebooker plugin taking control of  
> asset\_host. Only appears to be a problem while running passenger.

Should be a problem with anything. I’ve got a facebooker site in  
development under mongrel and it sets asset host as well…
