Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WP Engine doesnt support using htaccess file #290

Open
5 tasks done
Garcia-Julz opened this issue Oct 22, 2023 · 1 comment
Open
5 tasks done

WP Engine doesnt support using htaccess file #290

Garcia-Julz opened this issue Oct 22, 2023 · 1 comment

Comments

@Garcia-Julz
Copy link

Garcia-Julz commented Oct 22, 2023

WP Engine and .htaccess File Compatibility

Using JWT Authentication Plugin with WP Engine Hosting

Before submitting an issue, please answer the following questions:

  • I am running the latest plugin version (1.3.4).
  • I am running the latest WordPress version.
  • I know what PHP version I'm using.
  • I checked the documentation and found no answer.
  • I checked to make sure that this issue has not already been filed.

Context

WP Engine has informed me that they do not support the use of the .htaccess file, even if we were to edit it. Complying with their new standards is essential. Instead of using the code snippet provided in the documentation, WP Engine recommends using a Web Rule or Nginx code snippet to ensure the proper functioning of this plugin.

  • WordPress version: 6.3.2
  • PHP Version: 8.0.30
  • JWT Auth Plugin Version: 1.3.4

I attempted to convert the provided .htaccess code into Nginx syntax, but I encountered issues, which is why I'm seeking assistance.

Original .htaccess Code:

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

Attempted Nginx Configuration:

location / {
    fastcgi_pass   backend;
    fastcgi_param  HTTP_AUTHORIZATION $http_authorization;
    # Other fastcgi_params and configurations
}

Update

Made another attempt to get around this issue. I added this to my function.php

// Enable JWT authentication
add_filter('jwt_auth_cors_allow_headers', function($headers) {
    $headers[] = 'Authorization';
    return $headers;
}, 10, 1);

add_filter('jwt_auth_secret_key', function($key) {
    // Replace 'YOUR_SECRET_KEY_HERE' with your actual secret key
    $key = 'YOUR_SECRET_KEY_HERE';
    return $key;
}, 10, 1);

just tried this with WP Engine and it did NOT work

location / {
    # Your existing Nginx configuration here

    # JWT authentication
    auth_jwt "[Key I Generated]"; // Use the JWT secret key you defined in functions.php
    auth_jwt_key_file /dev/null; // Use /dev/null to indicate no key file is used
    auth_jwt_alg HS256;

    # Continue with your existing Nginx configuration
}

@jared-leddy
Copy link

Flywheel, owned by WP Engine, uses NGINX servers and Google Cloud. We have websites that are hosted on Flywheel that currently use this plugin with no issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants