Perl environment

Created at:
Avatar
Updated

 

Incapsula is deployed as a reverse proxy in front of your Perl application. This means that all traffic coming to your site through Incapsula will be seen as coming from one of Incapsula IPs.

In order to make sure that your Perl application gets the correct user IP you will need to make some modifications to way the IP is extracted.

Modify your code to extract the true visitor IPs:

Incapsula injects a dedicated header to each request that includes the original client IP (INCAP-CLIENT-IP and X-FORWARDED-FOR). You should use this header to extract the client IP anywhere in the code where the client IP is referenced. 

The header name should be HTTP_INCAP_CLIENT_IP and HTTP_X_FORWARDED_FOR.

Example: 

# cat ipDetect.pl
#!/usr/local/bin/perl

$IncapClientIP = $ENV{'HTTP_INCAP_CLIENT_IP'};
$HTTP_X_FORWARDED_FOR = $ENV{'HTTP_X_FORWARDED_FOR'};

print "Content-type: text/html; \n\n";
print "IncapClientIP: $HTTP_INCAP_CLIENT_IP <br>";
print "HTTP_X_FORWARDED_FOR: $HTTP_X_FORWARDED_FOR <br>";

exit;

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk