Installation

Error related to apache configuration and "remote_addr"

Error related to apache configuration and "remote_addr"

by Ben Rush -
Number of replies: 6
Hey all, sorry again for yet another question...I seriously thought I had this resolved. 

Here's my current situation: after successfully logging in, I get the following error: 

Can't locate object method "remote_addr" via package "Apache2::Connection" at /opt/webwork/webwork2/lib/WeBWorK/Authen.pm line 920.


Unfortunately the only solution stated on that page involves copying over the "webwork-apache2.4-config file instead of webwork-apache2-config.". Well, I started off with that in place: 

root@brush:/etc/apache2/conf-enabled# file webwork.conf
webwork.conf: symbolic link to `/opt/webwork/webwork2/conf/webwork.apache2.4-config'

So am I doing another dumb thing? 

One thing to note (and I'm not sure if this is something that basically invalidates everything I'm doing), because I've got other websites on this box I'm not using the prefork apache2 as described in the setup instructions. Could this be the problem? 

This is what I'm running: 

root@brush:/etc/apache2/conf-enabled# apache2 -v
Server version: Apache/2.4.7 (Ubuntu)
Server built:   Jul 22 2014 14:36:38
root@brush:/etc/apache2/conf-enabled#


Thanks again. 

Addendum: 

Simply commenting out the portion that's doing the parsing of the get_server_banner() method "fixed" it for me. Maybe there's a bug in there? 

        my $APACHE24 = 2.4;


# Commented this out.....
        #warn Apache2::ServerUtil::get_server_banner() ;
        #if (MP2 && Apache2::ServerUtil::get_server_banner() =~
        #  m:^Apache/(\d\.\d+\.\d+):) {
        #    $APACHE24 = version->parse($1) >= version->parse('2.4.00');
        #}

In reply to Ben Rush

Re: Error related to apache configuration and "remote_addr"

by Lasha K -
Hello Ben,
Thanks for your post and providing a temp fix.

I started with Debian Jessie (Testing), so the reason why I have encounter the same problem is not because of the recent Debian upgrade rather it is related to changes introduced earlier in Apache 2.4.

If I try to turn off server token on Apache 2.4.10 web server using
ServerTokens Prod

in /etc/apache2/conf-enabled/security.conf
I am getting the same error as you mentioned (also mentioned here).
If I set this option to
ServerTokens OS
Then everything works as expected.
In reply to Lasha K

Re: Error related to apache configuration and "remote_addr"

by Ben Rush -
What is the policy for trying to provide a fix, then? I think I could probably fix this issue and see if it rolls back into a next release. 
In reply to Ben Rush

Re: Error related to apache configuration and "remote_addr"

by Geoff Goehle -
Does your server banner have the version in it ? WeBWorK looks for the server version in the banner and if it can't find it, it assumes you do not have 2.4, which causes the remote_addr errors if you do.  By setting $APAHCE24 manually, as you did, you get around that.  Another thing you could try is to make sure your server banner has the version:

ServerTokens Minimal
In the next version there will be a configuration variable to set the version manually.  
In reply to Geoff Goehle

Re: Error related to apache configuration and "remote_addr"

by Peter Staab -
We're running ubuntu and just did some updates and ran into this error. My guess is that ubuntu just pulled in the debian version of mod perl that caused problems last year (jan 2015).  Since it seems that setting $APACHE24  (line 928 of Authen.pm -- develop branch) is a bit of a hack, it appears that changing line 938 from

Apache2::ServerUtil::get_server_banner()

to

Apache2::ServerUtil::get_server_description()

works.  It's unclear from the documentation that this works in general for all servers, but was wondering if we have a better fix for this.  
In reply to Peter Staab

Re: Error related to apache configuration and "remote_addr"

by Nathan Wallach -

Since I ran into this issue after changing the Apache config to use "ServerTokens Prod" and did not find the current recommended solution in the forums or the current install docs, I have added it to the WW 2.15 installation instructions on the wiki in the section about site.conf, and am posting in the relevant forum threads.

The best approach to fixing errors of this type is for the site.conf file to manually provide a value for "$server_apache_version" in site.conf. This was explained in the release notes for version 2.11 at https://webwork.maa.org/wiki/Release_notes_for_WeBWorK_2.11 but has not been well document elsewhere.

In reply to Nathan Wallach

Re: Error related to apache configuration and "remote_addr"

by Nathan Wallach -
At present, in WW 2.15 and apparently back to WW 2.11, the setting
$server_apache_version = '2.4';
in site.conf should work, but not forms like
$server_apache_version = '2.4.29';
with 3 numeric parts to the version number. This is due to a bug in the code adding support for this setting. Hopefully this will be fixed in WW 2.16, and maybe in a hotfix to WW 2.15.
See: https://github.com/openwebwork/webwork2/pull/1145