Forbidden error on IE11 when accessing via computer name
Posted by: batman697 (---.syrcny.fios.verizon.net)
Date: June 24, 2015 04:27PM

WAMP 2.5, Windows 7 64 bit, Apache 2.4.9


I have one instance where I get a forbidden error -accessing my site on WAMP via a URL with my computer name. If I access it via "localhost/site", it works. If I access it via "computer-name/site" it does not work on IE11 (but it works on Chrome). Very strange. I can probably work around it but it's aggrevating

Options: ReplyQuote
Re: Forbidden error on IE11 when accessing via computer name
Posted by: batman697 (---.syrcny.fios.verizon.net)
Date: June 24, 2015 04:28PM

The apache access log isn't helping me. Here's what I see - first entry is IE11, second entry is Chrome

computername.network.com - - [24/Jun/2015:10:12:42 -0400] "GET /test-site-1/ HTTP/1.1" 403 303
computername.network.com - - [24/Jun/2015:10:14:12 -0400] "GET /test-site-2 HTTP/1.1" 301 340


Apache error log

[Wed Jun 24 10:12:42.453728 2015] [authz_core:error] [pid 11336:tid 832] [client fe80::redacted:63015] AH01630: client denied by server configuration: C:/wamp/www/test-site-1/



Edited 1 time(s). Last edit at 06/24/2015 04:31PM by batman697.

Options: ReplyQuote
Re: Forbidden error on IE11 when accessing via computer name
Posted by: RiggsFolly (---.as43234.net)
Date: June 24, 2015 05:41PM

Hi Batman

This one interested me, I have never seen the need to use my PC's ComputerName as a domain name in the browser but I have seen people wondering why they cannot do that.

So here are my finding :-

1. Anything you put in the browser is going to be treated as a domainname and an attempt will be made to convert that name to an actual IP address using local or remote DNS lookup.

2. When I use 'http://MyComputerName` in the browser I get the error
-- Forbidden You don't have permission to access / on this server.

3. Now this is a pretty standard error and normally means that Apache is saying I am not allowed to accept connections from the IP address trying to connect to me.
This made me think, well what is the ip address of that domain name so I did a ping on it

--> ping MyComputerName

---Result-- Pinging MyComputerName [fe80::54c8:d12f:6bf1:f6ce%10] with 32 bytes of data:

--> ping /4 MyComputerName

---Result-- Pinging MyComputerName [192.168.2.11] with 32 bytes of data:

Ok so now we know what ip address the browser is getting from some DNS somewhere. This has to be local to my PC as these addresses are both part of the Private Network address space. ( i.e. cannot be routed over the internet) which is why I dont need to pbfiscate them in this reply.


4. So now its obvious.
-- We have not told Apache that it is allowed to accept connections from these addresses.

-- By default WAMPServer is configured as a local development tool. In other words to protect the beginner from
-- themselves the httpd.conf file is configured like this

<Directory "c:/wamp/www/">

    ## comments removed for brevity

    Options Indexes FollowSymLinks

    AllowOverride all

#   onlineoffline tag - don't remove
    Require local
</Directory>

Now Require local is Apache 2.4 speak for Only this machines loopback addresses.
-- So only these few ip addresses

127.0.0.1 (ipv4 loopback address)
::1       (ipv6 loopback address)
and 
localhost which of course is defined in the hosts file on both 127.0.0.1(ipv4) and ::1(ipv6)


So boil all that down and we get. You have not told Apache it is allowed to be connect to by the ip address of the MyComputerName


So to change Apache to allow this I would add the following to httpd.conf, well actually I would not bother, but you might.
I originally considered adding the ip addresses to the list but then I thought why not use the `hosts` option.

Edit httpd.conf as follows

<Directory "c:/wamp/www/">

    ## comments removed for brevity

    Options Indexes FollowSymLinks

    AllowOverride all

#   onlineoffline tag - don't remove
    Require local
    Require host MyComputerName
</Directory>


And then Apache allowed my in to my WAMPServer homepage

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-



Edited 3 time(s). Last edit at 06/24/2015 05:45PM by RiggsFolly.

Options: ReplyQuote
Re: Forbidden error on IE11 when accessing via computer name
Posted by: Otomatic (Moderator)
Date: June 24, 2015 07:00PM


Options: ReplyQuote


Sorry, only registered users may post in this forum.