I am using a wordpress plugin name JWT Authentication for WP REST API, it has some rules written in .htaccess but i am using nginx server and want to add these rule in nginx configurations
rewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
CodePudding user response:
You can easily convert your .htaccess
rule to nginx Please follow the blog here you can find your solution:
https://www.nginx.com/blog/converting-apache-to-nginx-rewrite-rules/
CodePudding user response:
RewriteCond %{HTTP:Authorization} ^(.*) RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
You shouldn't need to convert this Apache rule to work in Nginx.
This rule is a workaround for a specific Apache security feature (hobble) that is imposed by Apache when PHP is installed as CGI, as opposed to an Apache module. AFAIK, the same issue does not apply to Nginx.
(Basically, Apache prevents the Authorization
HTTP request header being sent to all backend CGI scripts to prevent usernames/passwords being inadvertently sent to untrusted scripts. Unfortunately, this also includes PHP.)