Can anyone help to change this .htaccess rule to nginx?

Viewed 227

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]
2 Answers
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 when installed as (Fast)CGI.)

Related