Problems activating Institutional Subscriptions for proxy servers

Hi @Enzo,

How are you entering the IP ranges?

Regards,
Alec Smecher
Public Knowledge Project Team

As in the picture (but with different numbers).
Indeed i didn’t insert a range but just a specific IP address (the same that the client get from http://www.get-myip.com/ or similar services)

Bye.

Hi @Enzo,

I’m not sure I understand. It sounds like single IPs are working fine, but IP ranges are not. Can you give me an example of an IP range you’re trying?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi.
Actually I don’t used an IP range but a single IP address like this: 83.104.28.264 (for privacy I changed them). It is the exiting IP proxy server that our client can read checking on http://www.get-myip.com/. And it doesn’t work.
While with the IP machine, the one of single PC like 192.154.2.15, it does, but it means that I have to know the IP (or IP range) of all machines, while I know just the web server IP.

Thanks.
Enzo

Hi @Enzo,

I’d suggest testing to see how your server environment is presenting IP address to PHP. One way to do that is to create a script containing…

<?php print_r($_SERVER);

Fetch the result through a machine with the connection you’re trying to debug and you should see a dump of server variables. Check the various headers to see where and how the various IPs are showing up. In particular, look at REMOTE_ADDR and X_FORWARDED_FOR.

(Don’t leave that script lying around – it’s not dangerous per se but will expose some details about your server that aren’t normally visible.)

Regards,
Alec Smecher
Public Knowledge Project Team

We have a similar issue.

If I go for example here: https://www.whatismybrowser.com/
I see two IP addresses:
IP Address 84.239.xxx.xxx
Local IP Address 192.168.xxx.xx

The first value, 84.239.xxx.xxx, is the one that most of the “my ip address” pages print out.

However, OJS seems to check the other value: $_SERVER[‘REMOTE_ADDR’] which is 192.168.xxx.xx

I think the question is that what is the difference between these two values and which one is the “right” one?

Hi @ajnyga,

Is your server behind a proxy?

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you.
So this is what I get:

Array ( ...  [REMOTE_ADDR] => 192.16X.X.XX [SERVER_PORT] => 80 [SERVER_ADDR] => 151.23X.XX.X [SERVER_NAME] => mysite.com [SERVER_SOFTWARE] => Apache [SERVER_SIGNATURE] => 
Apache Server at mysite.com Port 80
... [HTTP_VIA] => X.X 192.16X.X.XXX (McAfee Web Gateway X.X.X.X.X.XXXXXXX) ... [HTTP_CONNECTION] => close ... [HTTP_X_REAL_IP] => 83.103.XX.XXX [HTTP_HOST] => mysite.com ... )
  • REMOTE_ADDR is different from HTTP_VIA
  • HTTP_X_REAL_IP (83.103.XX.XXX) is what my client get from www.get-myip.com. The one that I tried to insert in IP range of the subscription with no results

Regards,
Enzo

Hi @Enzo,

Is X_FORWARDED_FOR included in the data dump?

Regards,
Alec Smecher
Pulbic Knowledge Project Team

No. I don’t see it.

Enzo

Maybe the problem is a bad configuration of proxy.
Probably OJS associate the subscription to the [REMOTE_ADDR] and not to the [HTTP_X_REAL_IP] info.
Our client connection has as [REMOTE_ADDR] the private machine IP and not the public IP.
If so, can you suggest a workaround (apart the correct configuration of proxy?)

Thank you.
Enzo

Hi @asmecher and @Enzo

The fact I was showing a local IP instead of the actual IP with REMOTE_ADDR was probably due to the fact that I was in the same network with our server. At least I think so, because when I called the script with the function from my home connection, it showed the correct IP. I did not get a value for X_FORWARDED_FOR with my work connection or with my home connection.

The real reason behind our difficulties was actually that the format defined for the subscription type was incorrect. It was set to Print but for the institutional subscriptions to work, it has to be Online or Print and Online. I am managing these straight from the database for OJS3 so I missed the label for these values.

Sorry for interrupting you thread @Enzo, hopefully you will get that solved!

It’s OK @ajnyga.

Bye.
Enzo

Hi @Enzo,

The X_FORWARDED_FOR header is standard, and in a quick search it looks like it’s supported by McAfee Web Gateway. If your proxy isn’t providing it, the best work-around is to modify OJS’s PKPRequest class to have the getRemoteAddr function look at one of the headers that your set-up is providing.

Regards,
Alec Smecher
Public Knowledge Project Team

Where do I find this function?

Thanks.
Enzo

Hi @Enzo,

It’s in lib/pkp/classes/core/PKPRequest.inc.php.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi Alec,

How do you run this comment on the server? From the CLI or somewhere else? Thanks!

Hi @radjr,

You’d need to edit the .inc.php file, which you can do a number of ways, including via the command line.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi Alec, I was referring to the script above. I thought the forum software would put my query in line with the message from two years ago… Thanks, radjr

Hi @radjr,

You could either create it using the command line, or use something like a CPanel file manager. You’d need to put this source code in a .php file and then call it through your browser.

Regards,
Alec Smecher
Public Knowledge Project Team