Dealing with Error Messages
If you see an error message after integrating, it's usually something that's easily rectifiable!
When you integrate with Ezoic, the system will act as a proxy between your site and your users. Without a proxy, requests for your content would come directly from the user's IP address. When Ezoic is turned 'on', this requests will start coming via IP addresses from Amazon's Web Servers (AWS). This can sometimes be classified as 'bot' traffic by your server, or prevent users from accessing content behind a login. If this happens, you may see a '520' error, or a '401' error, which may read 'your IP has been used by spambots to register multiple times'. Or, you may receive a '503' error, which may be due to requests being timed out when connecting to the host server.
There are three main options to help your host pass along requests from the Ezoic system, all three of which will be covered in this article:
(1) Whitelisting Ezoic's IP Addresses: choose this if your host is blocking requests coming via Ezoic's IP addresses. You might see a '403 Forbidden' or 'Origin Error'.
(2) User Agent Authentication: another option to prevent your host from blocking Ezoic's requests, this option allows your server to pass along requests that come via Ezoic.
(3) X-Forwarded-For - XFF or HTTP Header: this is the option to choose if you need your server to be able to see the 'real' IP of your user.
Whitelisting Ezoic's IP Addresses:
In rare cases, your hosting company may inadvertently block Ezoic’s servers (AWS) from your site’s content. You may see a '403 Access Forbidden' error or 'Origin Error' when this occurs.
If the hosts are using IP addresses to block, feel free to ask them to whitelist Ezoic's range of IP addresses.
User Agent Authentication:
If your host is blocking requests, you can also ask them to set user agent authentication for 'X-middleton' (which comes with all requests).
This will authenticate the requests coming via Ezoic and stop them from getting blocked.
In plain English, the X-Forwarded-For header is a header field that you can use to make sure the 'real' IP of your users is passed along by a proxy like Ezoic or Cloudflare. Without this, only the IP of the proxy would be passed along. Some features (like login forms) might need to see the original user's IP. You can add this header to your server, or ask your host to do it for you. By implementing X-Forwarded-For on your site, Ezoic will send the IP address of the original web visitor through to your server in the X-Forwarded-For header:
In PHP it is available in: $_SERVER['HTTP_X_FORWARDED_FOR']
You will need to put the code above in a file that all of your pages access (e.g. header.php, init.php or config.php). You should see $_SERVER['REMOTE_ADDR'], which you can replace with $_SERVER['HTTP_X_FORWARDED_FOR']
In .NET it’s available in HttpContext.Current.Request.Headers["X-Forwarded-For"]
If you are seeing a '301 redirect' error, it's possible that there is an error at your host and you will need to contact them to check. It's also a good idea to check your DNS records match those you have entered at Ezoic.
Help and Advice
If you need more advice on any of the information in this article, don't hesitate to reach out to your account manager or firstname.lastname@example.org.