If you are using Xserver to manage your WordPress site, you may not be able to access the WordPress REST API from Google Apps Script (GAS). This is because Xserver’s security settings restrict access from overseas. In this case, you can fix the problem by adjusting your security settings to allow access from GAS.
Why is access from overseas restricted?
Xserver has a standard setting to restrict access from overseas for enhanced security. This is to prevent unauthorized access and attacks, but it also blocks access from non-Japanese servers like GAS. This causes a problem that you cannot access WordPress REST API from GAS.
Solution: Allow access from overseas in security settings.
- Log in to the Xserver administration panel and open the “Server Panel”.
- Select “WordPress Security Settings” menu.
- Select the domain to be configured, and set “Disable” to restrict access from overseas IP addresses.
- Save the settings and let the changes take effect.
Now, access from overseas will be allowed and you will be able to access WordPress REST API from GAS.
How to configure for security
Allowing international access allows all access to be accepted without restrictions, but may increase security risks; use a combination of basic and token authentication for access to the REST API to ensure that the access you allow is secure. For example, it is recommended to use plug-ins to add authentication to API requests.