Maybe your case was different from mine, but I want to share with you how I fixed this issue, hoping will be useful for other people.
In my case the issue was caused by All In One Wordpress Security Plugin (AIOWS), due to "IP RETRIEVAL SETTINGS" configuration.
My site is hosted on AWS, via Elastic Beanstalk environment and I have different instances under ...
Look in your wp_options database table for the siteurl and home options and check these are using your local URL.
As Captain S commented, these can also be overridden in your wp-config:
check your wp-config.php if you have defined 'WP_HOME' and/or 'WP_SITEURL'. Setting these values will override the wp_options table values. If that doesn't help I recommend the tool database search and replace.
Hope that helps.
I was able to solve the problem by adding these two lines to /var/www/my-wp-site.com/public_html/wp-config.php:
define( 'WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] );
define( 'WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] );