Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Forbidden error for static files (javascripts, images, etc.)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  15 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jared White  
View profile  
 More options Apr 12 2008, 2:53 am
From: Jared White <intuitivefut...@gmail.com>
Date: Fri, 11 Apr 2008 23:53:18 -0700 (PDT)
Local: Sat, Apr 12 2008 2:53 am
Subject: Forbidden error for static files (javascripts, images, etc.)
I installed Passenger on my Ubuntu box with a custom-built Apache
2.2.6, and all of the Rails side of the app works great, but static
files are not being loaded. I get a standard 403 Forbidden error
served by Apache, and in my error_log file, all I get is

client denied by server configuration: /myxyzappfolder/public/
javascripts/effects.js

etc. My app appears to have been spawned by my regular user account on
the box and all my app files are owned by me, not to mention they're
at least readable by everyone. I had renamed .htaccess to
htaccess.dumb just in case mod_rewrite was messing something up, but
that didn't help.

Any ideas or tips on how to troubleshoot further? It seems like this
should be a no-brainer, but I can't figure it out.

Jared


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tamerhelmysalama@gmail.co m  
View profile  
 More options Apr 12 2008, 3:19 am
From: "tamerhelmysal...@gmail.com" <tamerhelmysal...@gmail.com>
Date: Sat, 12 Apr 2008 00:19:21 -0700 (PDT)
Local: Sat, Apr 12 2008 3:19 am
Subject: Re: Forbidden error for static files (javascripts, images, etc.)
"Static assets are accelerated, i.e. they are served directly by
Apache and do not go through the Rails stack".

I think this is straight an Apache error.

Google gave valid answers - http://www.google.ca/search?q=+client+denied+by+server+configuration

On Apr 12, 12:53 am, Jared White <intuitivefut...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
hellolinus@gmail.com  
View profile  
 More options Apr 12 2008, 9:06 am
From: "helloli...@gmail.com" <helloli...@gmail.com>
Date: Sat, 12 Apr 2008 06:06:02 -0700 (PDT)
Local: Sat, Apr 12 2008 9:06 am
Subject: Re: Forbidden error for static files (javascripts, images, etc.)
On Apr 12, 8:53 am, Jared White <intuitivefut...@gmail.com> wrote:

I had the same issue, try something like this:

<VirtualHost *:80>
  ServerName selleo.com
  ServerAlias www.selleo.com
  DocumentRoot /var/www/selleo.com/public
  <Directory "/var/www/selleo.com/public">
        Options FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
  </Directory>
  RailsBaseURI /
</VirtualHost>

Cheers,
Tomasz Bak


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jared White  
View profile  
 More options Apr 12 2008, 11:37 am
From: Jared White <intuitivefut...@gmail.com>
Date: Sat, 12 Apr 2008 08:37:28 -0700 (PDT)
Local: Sat, Apr 12 2008 11:37 am
Subject: Re: Forbidden error for static files (javascripts, images, etc.)
Ah, that makes sense. Thanks Tomasz, it works great now. I think the
docs should make note of this, considering that not everyone is going
to realize that they need to have a standard working setup in the
Apache config for accessing their static files BEFORE they even think
about putting in the Rails component. I thought that would happen
automatically.

Thanks again,

Jared

On Apr 12, 6:06 am, "helloli...@gmail.com" <helloli...@gmail.com>
wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ChrisR  
View profile  
 More options Apr 12 2008, 2:48 pm
From: ChrisR <EvilGeen...@gmail.com>
Date: Sat, 12 Apr 2008 11:48:41 -0700 (PDT)
Local: Sat, Apr 12 2008 2:48 pm
Subject: Re: Forbidden error for static files (javascripts, images, etc.)
Thanks Tomasz, it might have taken me a while to figure out this
obvious solution.

I agree with you Jared, the docs should make note of it.

Thanks
Chris


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hongli Lai  
View profile  
 More options Apr 13 2008, 7:23 am
From: Hongli Lai <hon...@phusion.nl>
Date: Sun, 13 Apr 2008 13:23:39 +0200
Local: Sun, Apr 13 2008 7:23 am
Subject: Re: Forbidden error for static files (javascripts, images, etc.)

ChrisR wrote:
> Thanks Tomasz, it might have taken me a while to figure out this
> obvious solution.

> I agree with you Jared, the docs should make note of it.

> Thanks
> Chris

Thanks for the feedback. I've updated the users guide accordingly.

--
Phusion | The Computer Science Company

Web: http://www.phusion.nl/
E-mail: i...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kivanio  
View profile  
 More options Apr 13 2008, 9:24 am
From: Kivanio <kiva...@gmail.com>
Date: Sun, 13 Apr 2008 06:24:48 -0700 (PDT)
Local: Sun, Apr 13 2008 9:24 am
Subject: Re: Forbidden error for static files (javascripts, images, etc.)
Hi,

i have problem with css, js and images.

i put the confs:

<VirtualHost *:
80>
    ServerName www.proalmat.facual.org.br
    DocumentRoot /home/www/ruby/proalmatfacual/
public

<Directory "/home/www/ruby/proalmatfacual/
public">
    Options
FollowSymLinks
    AllowOverride
None
    Order
allow,deny
    Allow from
all
</
Directory>

RailsBaseURI /
</VirtualHost>

but don't works for me, see logs:

ActionController::RoutingError (No route matches "/stylesheets/
defaults.css" with {:method=>:get}):
    /vendor/rails/actionpack/lib/action_controller/routing.rb:1441:in
`recognize_path'
    /vendor/rails/actionpack/lib/action_controller/routing.rb:1424:in
`recognize'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:
170:in `handle_request'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:
115:in `dispatch'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:
126:in `dispatch_cgi
ActionController::RoutingError (No route matches "/images/
menu_oproalmat.jpg" with {:method=>:get}):
    /vendor/rails/actionpack/lib/action_controller/routing.rb:1441:in
`recognize_path'
    /vendor/rails/actionpack/lib/action_controller/routing.rb:1424:in
`recognize'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:
170:in `handle_request'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:
115:in `dispatch'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:
126:in `dispatch_cgi'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:9:in
`dispatch'

httpd log:

[0x3368:StandardApplicationPool.h:0xf9] Cleaning idle app /home/www/
ruby/proalmatfacual (PID 0x33e8)
[0x3368:Application.h:0x112] Application 0x847cb00: destroyed.
[0x33cc:Hooks.cpp:0x172] Processing HTTP request: /
[0x3368:ApplicationPoolClientServer.h:0x1aa] Client 0x842a600:
received message: ['get', '/home/www/ruby/proalmatfacual', 'true',
'nobody']
[0x3368:Application.h:0x108] Application 0x847c860: created.
[0x3368:ApplicationPoolClientServer.h:0x1aa] Client 0x842a600:
received message: ['close', '13']
[13255:Hooks.cpp:370] Processing HTTP request: /images/menu_home.jpg
[0x3368:ApplicationPoolClientServer.h:0x1aa] Client 0x842a600:
received message: ['get', '/home/www/ruby/proalmatfacual', 'true',
'nobody']
[0x3368:ApplicationPoolClientServer.h:0x1aa] Client 0x842a600:
received message: ['close', '11']
[13254:Hooks.cpp:370] Processing HTTP request: /images/
menu_oproalmat.jpg
[0x3368:ApplicationPoolClientServer.h:0x1aa] Client 0x842a600:
received message: ['get', '/home/www/ruby/proalmatfacual', 'true',
'nobody']
[0x3368:ApplicationPoolClientServer.h:0x1aa] Client 0x842a600:
received message: ['close', '11']
[13253:Hooks.cpp:370] Processing HTTP request: /stylesheets/
defaults.css
[0x3368:ApplicationPoolClientServer.h:0x1aa] Client 0x842a600:
received message: ['get', '/home/www/ruby/proalmatfacual', 'true',
'nobody']
[0x3368:ApplicationPoolClientServer.h:0x1aa] Client 0x842a600:
received message: ['close', '4']
[0x33cd:Hooks.cpp:0x172] Processing HTTP request: /images/
transparente.gif
[0x3368:ApplicationPoolClientServer.h:0x1aa] Client 0x842a600:
received message: ['get', '/home/www/ruby/proalmatfacual', 'true',
'nobody']
[0x3368:ApplicationPoolClientServer.h:0x1aa] Client 0x842a600:
received message: ['close', '3']

i have other 3 app rails runing just with:

<VirtualHost *:
80>
    ServerName
estoque.facual.org.br
    DocumentRoot /home/www/ruby/intranetfacual/
public
</VirtualHost>

and i don't have problem, just the app above don't work.

PS: sorry for my bad english, i'm from brazil and i'm learning :)

On 13 abr, 07:23, Hongli Lai <hon...@phusion.nl> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kivanio Barbosa  
View profile  
 More options Apr 13 2008, 9:06 pm
From: "Kivanio Barbosa" <kiva...@gmail.com>
Date: Sun, 13 Apr 2008 21:06:16 -0400
Local: Sun, Apr 13 2008 9:06 pm
Subject: Re: Forbidden error for static files (javascripts, images, etc.)

Hi,
i solve my problem.

in my case, the problem was permissions.

in app with error, the permissions was 700, the rails work, but images
don't.

i change to 755, after 754, after 754, and 750.

all works fine now.

--
Kivanio Pereira Barbosa
Cel 8121-4248

www.eiqconsultoria.com.br


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
allenlux  
View profile  
 More options May 3 2008, 6:37 am
From: allenlux <johnbenal...@gmail.com>
Date: Sat, 3 May 2008 03:37:19 -0700 (PDT)
Local: Sat, May 3 2008 6:37 am
Subject: Re: Forbidden error for static files (javascripts, images, etc.)
I've followed all the guidance on this, but I still can't see the
images in my Rails application.

My virtual host looks like this:

<VirtualHost *>
        ServerAdmin john@kirtley

        DocumentRoot /home/usr/HomePage/Current/

        <Directory "/home/usr/HomePage/Current/">
                Options FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                Allow from all
        </Directory>

        <Directory "/home/usr/jallen/ruby/Depot2/public">
                Options FollowSymLinks
                Order allow,deny
                Allow from all
        </Directory>

                RailsBaseURI /app1
        RailsEnv development

</VirtualHost>

The Depot2 application (this is the sample application from the book
"Agile Web Development with Rails") lives at /home/usr/jallen/ruby/
Depot2

This folder and everything inside it has permissions 777 and belongs
to a general-purpose user "pcguest".

The DocumentRoot is "/home/usr/HomePage/Current" and within this
folder there is a symbolic link "app1" which points to /home/usr/
jallen/ruby/Depot2/public.

In the Apache error log, I'm seeing messages like:
[Sat May 03 12:17:18 2008] [error] [client 192.168.0.1] File does not
exist: /home/usr/HomePage/Current/images, referer: http://allenlux.dyndns.org/app1

which seems to indicate that the Rails application is looking for the
images in "/home/usr/HomePage/Current/images" which of course doesn't
exist. It should be looking in "/home/usr/jallen/ruby/Depot2/public/
images".

Everything else in the Depot2 application works fine.

Is this a bug in the application, or a problem with my Apache
configuration?

--
John Allen


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hongli Lai  
View profile  
 More options May 8 2008, 3:51 am
From: Hongli Lai <hon...@phusion.nl>
Date: Thu, 08 May 2008 09:51:01 +0200
Local: Thurs, May 8 2008 3:51 am
Subject: Re: Forbidden error for static files (javascripts, images, etc.)

allenlux wrote:
> which seems to indicate that the Rails application is looking for the
> images in "/home/usr/HomePage/Current/images" which of course doesn't
> exist. It should be looking in "/home/usr/jallen/ruby/Depot2/public/
> images".

Maybe your HTML is referencing /images/foo.png instead of
/app1/images/foo.png?

--
Phusion | The Computer Science Company

Web: http://www.phusion.nl/
E-mail: i...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
allenlux  
View profile  
 More options May 9 2008, 9:04 am
From: allenlux <johnbenal...@gmail.com>
Date: Fri, 9 May 2008 06:04:33 -0700 (PDT)
Local: Fri, May 9 2008 9:04 am
Subject: Re: Forbidden error for static files (javascripts, images, etc.)
On May 8, 9:51 am, Hongli Lai <hon...@phusion.nl> wrote:

> allenlux wrote:
> > which seems to indicate that the Rails application is looking for the
> > images in "/home/usr/HomePage/Current/images" which of course doesn't
> > exist. It should be looking in "/home/usr/jallen/ruby/Depot2/public/
> > images".

> Maybe your HTML is referencing /images/foo.png instead of
> /app1/images/foo.png?

Thanks, you are right. I changed the paths in the Depot2 application
and now the images are visible.

But now I have 2 more questions:

1. The Depot2 application worked fine with the original image
references when running under webrick or mongrel. It seems curious
that running under Passenger requires that all the image references
have to be changed.

2. The path  "/app1/images/foo.png" seems counter-intuitive to me. The
application folder is Depot2, so why isn't the path "/Depot2/images/
foo.png"? I thought that "app1" was just a way for Passenger to find
its way from the Apache virtual host to the real folder for the Rails
application.

John Allen


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hongli Lai  
View profile  
 More options May 9 2008, 10:00 am
From: Hongli Lai <hon...@phusion.nl>
Date: Fri, 09 May 2008 16:00:46 +0200
Local: Fri, May 9 2008 10:00 am
Subject: Re: Forbidden error for static files (javascripts, images, etc.)

allenlux wrote:
> 1. The Depot2 application worked fine with the original image
> references when running under webrick or mongrel. It seems curious
> that running under Passenger requires that all the image references
> have to be changed.

Back when it was running in Mongrel, was Depot2 deployed to a subdirectory?

Passenger doesn't, and can't, fix the HTML output for you - you have to
do that yourself.

> 2. The path  "/app1/images/foo.png" seems counter-intuitive to me. The
> application folder is Depot2, so why isn't the path "/Depot2/images/
> foo.png"? I thought that "app1" was just a way for Passenger to find
> its way from the Apache virtual host to the real folder for the Rails
> application.

Because "app1" is part of the URI while "Depot2" is part of the
filename. Since this is HTTP, you're supposed to reference everything by
URI. The actual on-disk filename has got nothing to do with it.
--
Phusion | The Computer Science Company

Web: http://www.phusion.nl/
E-mail: i...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
allenlux  
View profile  
 More options May 9 2008, 2:01 pm
From: allenlux <johnbenal...@gmail.com>
Date: Fri, 9 May 2008 11:01:56 -0700 (PDT)
Local: Fri, May 9 2008 2:01 pm
Subject: Re: Forbidden error for static files (javascripts, images, etc.)
On May 9, 4:00 pm, Hongli Lai <hon...@phusion.nl> wrote:
> allenlux wrote:
> > 1. The Depot2 application worked fine with the original image
> > references when running under webrick or mongrel. It seems curious
> > that running under Passenger requires that all the image references
> > have to be changed.

> Back when it was running in Mongrel, was Depot2 deployed to a subdirectory?

I just copied the demo application into the directory:
//kirtley/home/usr/jallen/ruby/Depot2

Underneath this directory are all the usual Rails folders: app/,
components/, public/, script etc.

With Depot2 as my current working directory, I can start the
application under Mongrel with the command script/server.

I then can access the application via the URLs:
http://kirtley:3000 (local only)
http://allenlux.dyndns.org:3000

This still works, although after changing the image paths for
Passenger the images can't be found by the instance of Depot2 running
under Mongrel.

> Passenger doesn't, and can't, fix the HTML output for you - you have to
> do that yourself.

> > 2. The path  "/app1/images/foo.png" seems counter-intuitive to me. The
> > application folder is Depot2, so why isn't the path "/Depot2/images/
> > foo.png"? I thought that "app1" was just a way for Passenger to find
> > its way from the Apache virtual host to the real folder for the Rails
> > application.

> Because "app1" is part of the URI while "Depot2" is part of the
> filename. Since this is HTTP, you're supposed to reference everything by
> URI. The actual on-disk filename has got nothing to do with it.

In theory, yes, but I still find it puzzling that 2 different servers
for Rails apparently handle these URIs differently.

John Allen


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hongli Lai  
View profile  
 More options May 9 2008, 2:54 pm
From: Hongli Lai <hon...@phusion.nl>
Date: Fri, 09 May 2008 20:54:19 +0200
Local: Fri, May 9 2008 2:54 pm
Subject: Re: Forbidden error for static files (javascripts, images, etc.)

allenlux wrote:
> In theory, yes, but I still find it puzzling that 2 different servers
> for Rails apparently handle these URIs differently.

I don't understand what you're expecting. It's your *HTML* that's
referencing the wrong URIs. Passenger or the web server have got nothing
to do with it.
--
Phusion | The Computer Science Company

Web: http://www.phusion.nl/
E-mail: i...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
allenlux  
View profile  
 More options May 9 2008, 4:52 pm
From: allenlux <johnbenal...@gmail.com>
Date: Fri, 9 May 2008 13:52:08 -0700 (PDT)
Local: Fri, May 9 2008 4:52 pm
Subject: Re: Forbidden error for static files (javascripts, images, etc.)
On May 9, 8:54 pm, Hongli Lai <hon...@phusion.nl> wrote:

> allenlux wrote:
> > In theory, yes, but I still find it puzzling that 2 different servers
> > for Rails apparently handle these URIs differently.

> I don't understand what you're expecting. It's your *HTML* that's
> referencing the wrong URIs. Passenger or the web server have got nothing
> to do with it.

I did a little more research which I should have done before, of
course.

This Rails wiki article seems to make it clearer, at least for me:
http://wiki.rubyonrails.com/rails/pages/HowToLinkToStaticFile

It does make the point
"When running under Webrick, files under the public directory can be
accessed using an absolute URL, as in

 <img src="/images/someimage.gif"/>"

but that this doesn't work for any server where the application is not
at the document root. In these cases it suggests

<%= image_tag "someimage.gif" %>

as a general solution for image files.

See also this thread:
http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/ea...

which was the origin of the wiki article.

Please tell me if you think the wiki is giving bad advice on this
issue.

John


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google