4

QUESTIONs

I'd like to know

  • why I am getting Network error: 403 Forbidden in firebug for files that I am not trying to access?

  • is it likely to cause any serious problems on the webserver?

  • how to fix it.

  • Why is my browser trying to access those files in the error message?

DETAILS

I’m using wampserver 2.2 to access a folder via the browser. The browser is on the same computer as the server. The computer is running windows 7 ultimate.

When I view a web folder via my browser hXXp://localhost/folder

I can see the folder contents ok enter image description here

but in firebug I get Network error: 403 Forbidden

enter image description here

I’m not deliberately trying to access those files in the error msgs. You will notice they are in a completely different folder to the one I am looking at.

I check the apache_error.log and see

[Wed Sep 26 00:05:10 2012] [error] [client 127.0.0.1] client denied by server configuration: C:/apache2, referer: hxxp://localhost/folder/

Wampserver 2.2 is installed on D drive.

I took a look at the httpd.conf file but I couldn't find any references to c:

When I look in Apache’s access.log I see

127.0.0.1 - - [26/Sep/2012:00:05:10 +0900] "GET /icons/blank.gif HTTP/1.1" 403 217
127.0.0.1 - - [26/Sep/2012:00:05:10 +0900] "GET /icons/back.gif HTTP/1.1" 403 216
127.0.0.1 - - [26/Sep/2012:00:05:10 +0900] "GET /icons/text.gif HTTP/1.1" 403 216
127.0.0.1 - - [26/Sep/2012:00:05:10 +0900] "GET /icons/unknown.gif HTTP/1.1" 403 219
127.0.0.1 - - [26/Sep/2012:00:05:10 +0900] "GET /icons/folder.gif HTTP/1.1" 403 218

CONFIGURATION

  • Wampserver 2.2 installed on Drive D
  • Apache 2.2.22
  • PHP 5.4.3
  • MySQL 5.5.24
  • Firebug 1.10.3
  • Firefox 15.0.1
TryHarder
  • 286
  • 1
  • 4
  • 14

3 Answers3

4

You have Options Indexes turned on somewhere in your configuration. That is what causes Apache to generate the page you are seeing above.

That page is made up of HTML and to the left of each item (where you see [ ] and [TXT] etc.) would normally appear an image representing the type of file that line is for. These images are requested, just like with any normal HTML page and they come from /icons/. This isn't actually a folder in your webroot but is aliases using something like Alias /icons/ "/usr/share/apache2/icons/".

Lastly, you have configured some other part of your Apache configuration to not allow these requests, hence you end up with a 403 response and the alt-text being displayed instead of the icons.

This is not likely to cause any serious problems but it's not something you would normally leave active (either Options Indexes or Alias /icons/ ...) on a production server.

Ladadadada
  • 25,847
  • 7
  • 57
  • 90
  • That makes a lot of sense. For the moment, I will leave it, but definitely I'll turn it off before putting the site live. Thanks for the help! – TryHarder Sep 26 '12 at 02:53
  • I had the same problem. This does not explain very clearly why this happens. Options Indexes is the reason to see list, but the wrong path is the reason not to see the icons and 403 Forbidden error message. – Bakudan Jul 16 '16 at 15:32
3

To fix the icon problem, I had to edit httpd-autoindex.conf located in \bin\apache\apache2.2.22\conf\extra

I changed

Alias /icons/ "c:/apache2/icons/"

to

Alias /icons/ "D:/wamp/bin/apache/apache2.2.22/icons/"

and

<Directory "c:/apache2/icons">

to

<Directory "D:/wamp/bin/apache/apache2.2.22/icons/">

The icons will now display as per usual.

Many thanks to Ladadadada for pointing me in the right direction!

TryHarder
  • 286
  • 1
  • 4
  • 14
  • 1
    I had the same issue with only 1 file and turned out to be file permissions. I changed permissions for Everyone as Read only. It was previously set to No access. – gogasca Feb 25 '15 at 17:42
0
  • Why I am getting Network error: 403 Forbidden in firebug for files that I am not trying to access?
  1. You have Options Indexes somewhere in the httpd.conf. This allows you to see list of files in the directory, and Apache will automatically generate this page for you and automatically try to add icons for the known types. In live ( production) environment you must not have Indxes.

Most likely where your document root is defined. It may look something like this:

DocumentRoot "${WEBROOT}/"
<Directory "${WEBROOT}/">
    HeaderName HEADER.html
    ReadmeName FOOTER.html
    IndexIgnore FOOTER.html HEADER.html
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
  1. Why you receive Network error: 403 Forbidden? You receive this because Apache tries to access the icons from a directory which does not exists at the specified loacation. Check carefully the paths - both in the httpd.conf and httpd-autoindex.conf. Probably the problem is a missing slash.
  • Is it likely to cause any serious problems on the webserver?
  1. By itelf this can't cause any problems. But this will show the files in the directory. So anybody can freely browse your files and directories and probably have access to files which shouldn't be accessed in that way, which is problem. So not a technical problem, but a human one.
  • How to fix it?
  1. Check the paths, carefully!
  • Why is my browser trying to access those files in the error message?
  1. The browser is just showing the page generated by Apache. It tryies to access all images in the page and show them. So it is not a browser fault. :)
Bakudan
  • 151
  • 1
  • 10