mod_proxy issues

Helicon Ape provides support for Apache .htacces and .htpasswd configuration files for Microsoft IIS.
User avatar
Posts: 5
Joined: 31 Aug 2012, 12:57

mod_proxy issues

31 Aug 2012, 13:03

My setup:

ASP.NET MVC 3
IIS 7.5
Windows Server 2008 R2
SQL Server

I'm trying to reverse proxy a location to another server, so something like this:

<Location /foo/bar>
ProxyPass http://some-other-box.mydomain.com/foo/bar
ProxyPassReverse http://some-other-box.mydomain.com/foo/bar
</Location>

But this doesn't work--I still get a 404 for the non-existent route in the MVC site. I've got an IgnoreRoute for "{resource}.apehandler/{*pathInfo}"--what more configuration do I need (if any). The Ape log doesn't show anything useful.

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: mod_proxy issues

03 Sep 2012, 06:02

Hello,

please try to to change the IgnoreRoute instruction like this:

IgnoreRoute for "{resource}.apehandler"

User avatar
Posts: 5
Joined: 31 Aug 2012, 12:57

Re: mod_proxy issues

05 Sep 2012, 18:08

Anton wrote:Hello,

please try to to change the IgnoreRoute instruction like this:

IgnoreRoute for "{resource}.apehandler"


Hi Anton,

I've tried this, but to no avail. The Global.asax.cs has a routes.IgnoreRoute ("{resource}.apehandler"), but I still get 404 errors. For an example URL http://my-site.com/foo/bar, I'll get a 404 for /foo/bar.apehandler, as if it's not being passed to Ape.

Looking at the Ape error log, I'm seeing the following which I did not see before:

Code: Select all
[9/5/2012 8:59:33 PM] [ConfigLoader] (4) [/] c:\websites\mysite\.htaccess(10): Invalid command '<Location /foo/bar>' on line 10, perhaps misspelled or defined by a module not included in the server configuration
[9/5/2012 8:59:33 PM] [ConfigLoader] (4) [/] c:\websites\mysite\.htaccess(13): Invalid command '</Location>' on line 13, perhaps misspelled or defined by a module not included in the server configuration


It's almost as if mod_proxy is not being loaded. Any suggestions?

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: mod_proxy issues

06 Sep 2012, 05:09

Hello,

please notice that <Location> section can be used only in global httpd.conf file and <VirtualHost> sections, but not in .htaccess.

User avatar
Posts: 5
Joined: 31 Aug 2012, 12:57

Re: mod_proxy issues

07 Sep 2012, 19:15

Hi Anton,

Thanks for pointing that out. However, even after moving those to the top-level httpd.conf, we still get a 404 for /foo/bar.apehandler. Do we need to add an IgnoreRoute in every application hosted on the server?

Thanks,
Bojan

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: mod_proxy issues

10 Sep 2012, 06:10

Hello, Bojan

Please show the entire .htaccess and web.config files as well as Ape error.log and rewrite.log.

"Do we need to add an IgnoreRoute in every application hosted on the server?"
- yes.

User avatar
Posts: 5
Joined: 31 Aug 2012, 12:57

Re: mod_proxy issues

11 Sep 2012, 13:59

We've added the ignore routes to every application on the server. The reverse proxy still doesn't work.

.htaccess is empty
rewrite.log is empty

Which web.config do you need? One for the site in question? One for every application on the server? We've made no modification to it for ape, are you thinking something else may be interfering with it?

Here is the ape.log most recent. Nothing interesting here:

[9/11/2012 1:04:00 PM] [LicenseManager] Site with id=1 is working with free license
[9/11/2012 1:04:00 PM] [cache_module] items stored in the cache: 3; bytes available for the cache: 1280185958, physical memory limit: 97%
[9/11/2012 1:04:00 PM] [LicenseManager] Trial days left 20. SiteId: 4
[9/11/2012 4:32:14 PM] [LicenseManager] Site with id=1 is working with free license
[9/11/2012 4:32:14 PM] [cache_module] items stored in the cache: 3; bytes available for the cache: 1280185958, physical memory limit: 97%
[9/11/2012 4:32:15 PM] [LicenseManager] Trial days left 20. SiteId: 4

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: mod_proxy issues

12 Sep 2012, 08:03

Hello, Bojan

Please make sure logging is turned on in httpd.conf like this:

RewriteLogLevel 9
LogLevel debug

and try to get the logs once again. (also please check the permissions for the log files)

As for the config, can you show the rules you have in httpd.conf and the test request you make.

Also, please try to switch off the Extensionless URLs feature in IIS (if it's currently enabled).

User avatar
Posts: 5
Joined: 31 Aug 2012, 12:57

Re: mod_proxy issues

12 Sep 2012, 14:53

We are not using IIS 7 extensionless urls as far as I'm aware.
rewrite.log is still empty.

Here is the whole httpd.conf, sample request is http://site.company.com/foo/bar/, which should load content from http://other-site.company.com/foo/bar/:

# Helicon Ape version 3.0.0.76

# Helicon Ape core configuration

#Automatically generated license file
Include licenses.conf

##----------------------------------------------------------------------
##
## The following code enables most detailed logging for Ape
##

#Loglevel debug
#ErrorLog error.log

#force Ape to ignore syntax errors in config
Options -StopOnError

##----------------------------------------------------------------------
##
## Read more about supported modules here http://www.helicontech.com/ape/doc/overview.htm
##

LoadModule authz_host_module modules/mod_authz_host.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule asis_module modules/mod_asis.so
LoadModule cache_module modules/mod_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dbd_exec_module modules/mod_dbd_exec.so
LoadModule dir_module modules/mod_dir.so
LoadModule disk_cache_module modules/mod_mem_cache.so
LoadModule developer_module modules/mod_developer.so
LoadModule env_module modules/mod_env.so
LoadModule expires_module modules/mod_expires.so
LoadModule filter_module modules/mod_filter.so
LoadModule gzip_module modules/mod_gzip.so
LoadModule headers_module modules/mod_headers.so
LoadModule hotlink_module modules/mod_hotlink.so
LoadModule linkfreeze_module modules/mod_linkfreeze.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule mime_module modules/mod_mime.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule replace_module modules/mod_replace.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule speling_module modules/mod_speling.so
LoadModule seo_module modules/mod_seo.so
LoadModule xsendfile_module modules/mod_xsendfile.so


##----------------------------------------------------------------------
##
## The following code enables most detailed logging for mod_rewrite
##

RewriteLog rewrite.log
RewriteLogLevel 9
LogLevel debug


##----------------------------------------------------------------------
##
## The following code hides .htaccess and .htpasswd files from sites visitors.
##

#
#<FilesMatch "^\.ht">
# Order allow,deny
# Deny from all
# Satisfy All
#</FilesMatch>


##----------------------------------------------------------------------
##
## Use htaccess.txt instead of .htaccess
## put it in the httpd.conf
##
#AccessFileName htaccess.txt


##----------------------------------------------------------------------
##
## Basic Authentication for the folder
##

#<Directory c:\inetpub\wwwroot\admin\>
# AuthType Basic
# AuthName "secret area"
# AuthBasicProvider file
# AuthUserFile c:\inetpub\.htpasswds
# Require valid-user
#</Directory>

##----------------------------------------------------------------------
##
## MD5 Digest Authentication
##

#<Location /private/>
# AuthType Digest
# AuthName "private area"
# AuthDigestDomain /private/ http://www.domain.com/myprivate/
# AuthDigestProvider file
# AuthUserFile c:/inetpub/passwords/.digest_pwd
# Require valid-user
#</Location>


##----------------------------------------------------------------------
##
## Enable memory-based cache for php files
##

#<Files *.php>
# ExpiresActive On
# ExpiresByType text/html "access 1 hour"
# CacheEnable mem
#</Files>


##----------------------------------------------------------------------
##
## Force Ape account for trailing slash redirects and index files
##

#DirectoryIndex index.html index.asp index.php
#DirectorySlash On


##----------------------------------------------------------------------
##
## Cache all cacheable content to the disk
##

## please create this folder before using
#CacheRoot c:\inetpub\cache
#SetEnv cache-enable disk

##----------------------------------------------------------------------
##
## Prevent ddos attacks
##

#<IfModule evasive_module>
# DOSPageCount 10
# DOSSiteCount 150
# DOSPageInterval 1
# DOSSiteInterval 1
# DOSBlockingPeriod 10
#</IfModule>



##----------------------------------------------------------------------
##
## Enable smart expiration
##

#ExpiresActive On
## html expires in a 2 hour
#ExpiresByType text/html A7200
## css expires in a 4 hour
#ExpiresByType text/css A14400



##----------------------------------------------------------------------
##
## The following code enables caching and compression for all static files
## accounting for browser peculiarities
##

#Include smart_gzip_compression.conf


##----------------------------------------------------------------------
##
## Stop hotlinking
##

#SetEnv mod_hotlink
#<Files *.pdf>
# HotlinkProtect /pdf [ Link, ParamName=hlb ]
#</Files>


#----------------------------------------------------------------------
##
## Enable Linkfreeze
##

#SetEnv mod_linkfreeze
#LinkFreezeRule --- "aspx=htm" [ AbsLinks,MoveExt ]


##----------------------------------------------------------------------
##
## Enable cache in-memmory
##

#<LocationMatch "/|/index.php">
# SetEnv cache-enable mem
#</LocationMatch>



##----------------------------------------------------------------------
##
## Enable proxying /accounts/ application to internal server
##

<Location /foo/bar>
ProxyPass http://other-site.company.com/foo/bar/
ProxyPassReverse http://other-site.company.com/foo/bar/
</Location>

<Location /baz/blah>
ProxyPass http://other-site.company.com/baz/blah/
ProxyPassReverse http://other-site.company.com/baz/blah/
</Location>


##----------------------------------------------------------------------
##
## Common rule for cms systems
##

#RewriteEngine on
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule (.*) /index.php [NC,L,NS]

##----------------------------------------------------------------------
##
#Header append Server "enhanced by Helicon Ape/3.0"

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: mod_proxy issues

13 Sep 2012, 08:14

Hello,

I think it would be better (more secure for you) to continue our conversation on our helpdesk (https://support.helicontech.com/helpdesk/).
Please catch and attach the wFetch log for you test request.
And also try to fix permissions so that the rewrite.log starts working.
Please also indicate the error you get when you request http://site.company.com/foo/bar/

User avatar
Posts: 1
Joined: 05 Nov 2014, 11:33

Re: mod_proxy issues

05 Nov 2014, 11:36

Hello,

I am experiencing the same exact issue. Was this ever resolved?


Thanks,
Todd

Return to Helicon Ape

Who is online

Users browsing this forum: No registered users and 5 guests