Post by jbcul » Mon Oct 11, 2021 5:58 am

We are on OC 1.5.6.4. Have added cloudflare code to address ip issues but still get occasional errors in error.log on server.
Code was added to index.php. Here is the code added. I left the top two lines in because help says to place this after //version.

Code: Select all

<?php
// Version
define('VERSION', '1.5.6.4');

// Cloudflare CDN
if ($_SERVER["HTTP_CF_CONNECTING_IP"]) {
$_SERVER["REMOTE_ADDR"] = $_SERVER["HTTP_CF_CONNECTING_IP"];
}
I still get these errors in my error.log

Code: Select all

[10-Oct-2021 20:31:15 UTC] PHP Notice: Undefined index: HTTP_CF_CONNECTING_IP in /hostpath/public_html/index.php on line 4
Any thoughts? Thanks.

Active Member

Posts

Joined
Fri Feb 01, 2013 9:18 am

Post by straightlight » Mon Oct 11, 2021 7:15 am

jbcul wrote:
Mon Oct 11, 2021 5:58 am
We are on OC 1.5.6.4. Have added cloudflare code to address ip issues but still get occasional errors in error.log on server.
Code was added to index.php. Here is the code added. I left the top two lines in because help says to place this after //version.

Code: Select all

<?php
// Version
define('VERSION', '1.5.6.4');

// Cloudflare CDN
if ($_SERVER["HTTP_CF_CONNECTING_IP"]) {
$_SERVER["REMOTE_ADDR"] = $_SERVER["HTTP_CF_CONNECTING_IP"];
}
I still get these errors in my error.log

Code: Select all

[10-Oct-2021 20:31:15 UTC] PHP Notice: Undefined index: HTTP_CF_CONNECTING_IP in /hostpath/public_html/index.php on line 4
Any thoughts? Thanks.
https://devanswers.co/get-real-client-i ... pache-php/

or contact your host to enable / configure it.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jbcul » Mon Oct 11, 2021 12:23 pm

Thanks. I'm contacting my host to see if they will do it. I don't have terminal access in my cpanel. Funny thing is I get customer ip addresses in my customer who's on line report.

Active Member

Posts

Joined
Fri Feb 01, 2013 9:18 am

Post by jbcul » Mon Oct 11, 2021 12:47 pm

Well look at that. Finally got the right person at my host. They opened the keys to the kingdom, I have server management access. Can implement this now. Thanks again.

Active Member

Posts

Joined
Fri Feb 01, 2013 9:18 am

Post by ADD Creative » Mon Oct 11, 2021 4:59 pm

jbcul wrote:
Mon Oct 11, 2021 5:58 am
We are on OC 1.5.6.4. Have added cloudflare code to address ip issues but still get occasional errors in error.log on server.
Code was added to index.php. Here is the code added. I left the top two lines in because help says to place this after //version.

Code: Select all

<?php
// Version
define('VERSION', '1.5.6.4');

// Cloudflare CDN
if ($_SERVER["HTTP_CF_CONNECTING_IP"]) {
$_SERVER["REMOTE_ADDR"] = $_SERVER["HTTP_CF_CONNECTING_IP"];
}
I still get these errors in my error.log

Code: Select all

[10-Oct-2021 20:31:15 UTC] PHP Notice: Undefined index: HTTP_CF_CONNECTING_IP in /hostpath/public_html/index.php on line 4
Any thoughts? Thanks.
Could just be some bot still connecting directly. You should use isset.

Code: Select all

if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) {
$_SERVER["REMOTE_ADDR"] = $_SERVER["HTTP_CF_CONNECTING_IP"];
}

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by jbcul » Mon Oct 11, 2021 10:59 pm

Thanks, will give that a test

Active Member

Posts

Joined
Fri Feb 01, 2013 9:18 am

Post by straightlight » Tue Oct 12, 2021 1:08 am

isset's already in the link I provided.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jbcul » Tue Oct 12, 2021 3:10 am

Yea. My apologies Straightlight, I missed that. my bad. Hopefully it will work.

Active Member

Posts

Joined
Fri Feb 01, 2013 9:18 am
Who is online

Users browsing this forum: No registered users and 37 guests