You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to configure JWT Authentication for WordPress REST API. But the problem is there is no direct config available for enabling the HTTP Authorization Header. Nginx doesn't have a .htaccess file, so I can't add the rewrite rules.
Here are the rules for apache based server:
RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
I believe it's not going to work with Nginx. What is the solution available for the Nginx side?
The text was updated successfully, but these errors were encountered:
For future reference, this goes in nginx's server block inside
server {
server_name yourdomain.com;
...rest of server block
if ($http_authorization ~ "^(.*)"){
set $rule_0 1;
}
if ($rule_0 = "1"){
set $http_authorization %1;
}
}
On Ubuntu default installations configuration files can be found under /etc/nginx/sites-available/. On hosting companies if there's a panel there should be a place that let the user edit "Server Blocks"
I am trying to configure JWT Authentication for WordPress REST API. But the problem is there is no direct config available for enabling the HTTP Authorization Header. Nginx doesn't have a .htaccess file, so I can't add the rewrite rules.
Here are the rules for apache based server:
I believe it's not going to work with Nginx. What is the solution available for the Nginx side?
The text was updated successfully, but these errors were encountered: