skip to Main Content

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


  1. 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/

    Login or Signup to reply.
  2. 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.)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search