-1

This is driving me stir crazy and I have researched across the Internet trying various answers none of which have worked.

I am using Apache 2.2.9 for Windows and my httpd.conf is as follows:

  NameVirtualHost *:80
  <VirtualHost *:80>
       ServerName MyLocalMachine.MyDomain.com
       DocumentRoot "C:/MyFolder/"

      <Directory "C:/MyFolder/SubDirectoryOne/SubDirectoryTwo">
         Options -Indexes FollowSymLinks
         AllowOverride All
         Order allow,deny
      </Directory>

     ProxyPass /MyFolder/SubDirectoryOne/ http://ServerOne.MyDomain.com/MyFolder/SubDirectoryOne/
     ProxyPassReverse /MyFolder/SubDirectoryOne/ http://ServerOne.MyDomain.com/MyFolder/SubDirectoryOne/
    </VirtualHost>
Andy5
  • 145
  • 1
  • 3
  • 10
  • can you try adding ' Allow from all ' below ' Order allow,deny' in Directory section – Sachin Singh Aug 03 '16 at 14:24
  • also for proxyPass section refer : https://wiki.apache.org/httpd/ClientDeniedByServerConfiguration – Sachin Singh Aug 03 '16 at 14:28
  • I have tried swapping the Allow from all around and it made no difference. Yes, I did look at Apache's wiki where I tried the solutions suggested, but none have worked – Andy5 Aug 03 '16 at 14:31
  • Two things: `AllowOverride All` means that you allow `.htaccess` files to amend the server configuration on a per directory basis and an access restriction in a `.htaccess` file may result in the same message. Second: can the error originate not from Apache but from the target of your ProxyPass? – HBruijn Aug 03 '16 at 15:07
  • What I am doing is prototyping a configuration for eventual production to tease out these issues. The actual test is a web based application (internal not public) and in my development environment I am having the server to call a URL to my desktop where I have apache, through the proxypass I am then calling back to the server. Other proxypass doing this type of setup have worked apart from this one. The only difference here are the subdirectories – Andy5 Aug 03 '16 at 15:42

2 Answers2

0

You are just giving access to a subdirectory, while the documentroot has no permissions.

Also do not mix "absolute" Options "FollowSymlinks" with relative Options (-Indexes) you either, use +/- or not at all in all your options, but do not mix it.

The correct configuration for the directory would be:

 <Directory "C:/MyFolder/">
   Options FollowSymlinks  # Or Options -Indexes +FollowSymlinks
   Allow from all
   Order deny,allow
</Directory>

Try with this, because this "must" allow access to the documentroot and all directories, but if you don't specify the documentroot and only just a subdirectory you are leaving the rest of the directories in the tree under documentroot without access.

SideNote:

Also, it is important to note that ProxyPass directives do not specify full paths, but relative to DocumentRoot so maybe your ProxyPass should be:

ProxyPass /SubdirectoryOne/ ...

Once you see it works, you can then add your AllowOverride all if necessary. Although if you have access to the main configuration yous shoudln't use .htaccess files at all, since it is just intended for users with limited rights in certain directories, not for administrators. It will also increase the overhead in the server as well as complicate configuring apache.

Daniel Ferradal
  • 2,415
  • 1
  • 8
  • 13
0

Unfortunately your configuration doesn't really make sense.

When you ProxyPass to are sending the request to another "back-end" service, where as <Directory> controls what Apache does when that virtual host maps the request to the file system. A single virtual host cannot do both with the same request.

I would start by adding individual access/error logs to each virtual host you have (if you have more than one) to verify the request is landing where you think it is. Run "httpd -S" to see how many virtual hosts you have defined.

The most common causes of "client denied by server configuration" are detailed here: http://wiki.apache.org/httpd/ClientDeniedByServerConfiguration

Unbeliever
  • 2,336
  • 1
  • 10
  • 19