In this video I will show you how to fix API Authentication errors that you may be running into.
If your WordPress website is using the Bitnami Image on lightsail and uses a plugin or theme that requires APIs that need authorization or authentication, you may run into errors even though you may have everything setup correctly in your website.
REST APIs that need to be authorized typicaly use the Basic Authentication Authorization header information that is passed from your website to the API Endpoint. But if Apache is not configured to send that information then it may not work. Bitnamis WordPress image in Lightsail does not set this configuration by default.
In this video I will show you how to update the Apache configuration to allow authentication headers for your API.
If you still experience API issues after this configuring this setting then there could be some other problems and I’ll link to some posts that may help troubleshoot if that is the case. So without further ado, let’s get started.
- Open SSH to your server
- Open the HTTPD configuration file
- vi apps/wordpress/conf/httpd-app.conf
- Add following after the <directory> tag
SetEnvIf Authorization “(.*)” HTTP_AUTHORIZATION=$1
- Add this to the rewriterule as shown in the video
- Restart Apache
- sudo /opt/bitnami/ctlscript.sh restart apache
- Ensure your website still loads.
- Test the API that was having issues.
- If the issue still exists, there could be other factors
- Check this post where they outline other fixes and solutions
- WordPress also has some documentation if you use the nginx webserver.