Some web servers strip the Authorization header before WordPress sees it. When that happens, no API key can sign in.

The SmartMembers API keys screen on the AI Weekly site with a yellow warning: Your host removes the Authorization header, so no API key can sign in. See the fix
The warning appears above your keys when the header does not arrive.

Pro: API keys are part of SmartMembers Pro. The fix is on your server, not in SmartMembers.

The symptom

SmartMembers → Settings → Connections → API keys shows Your host removes the Authorization header, so no API key can sign in. Every API request is refused with Use an API key from SmartMembers → Settings → API keys., even with a correct key.

The screen checks this each time it opens by sending a test header to your own site. Many Apache and FastCGI setups don't pass the header to PHP unless told to.

How to fix it

Try these in order. Reload the API keys screen after each one; when the warning is gone, keys work.

Save your permalinks

Go to Settings → Permalinks and click Save Changes. On Apache this rewrites .htaccess, which passes the header on.

Edit .htaccess (Apache)

Add these lines at the top of .htaccess in your site's main folder:

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

If that does nothing, use SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 instead, or CGIPassAuth On on Apache 2.4.13+.

Warning: Back up .htaccess first. A typo takes the site down.

Edit the server config (nginx)

Add this to the block that passes requests to PHP, then reload nginx:

fastcgi_param HTTP_AUTHORIZATION $http_authorization;

Ask your host

If the warning stays, a firewall, CDN, security plugin or the host's setup is stripping the header. Ask your host to pass the Authorization header to PHP.

Once the warning is gone, run a key's Test it command to confirm. Lost the key? Revoke it and create a new one.

Related articles