• Resolved fabo137


    Hi all

    I’m trying to get a Domain Key within the litespeed cache plugin.

    I’m currently running the site on a jelastic environment based on https://docs.jelastic.com/wordpress-cluster/

    So Basically a Litespeed ADC and a Litespeed WebServer backed by a MARIADB Cluster.

    Basically all works fine but getting the domain key returns the following error:
    1) The POST callback to https://uat-3.hebu-shop.ch/wp-json/litespeed/v1/token failed.

    The server returns a 401 error. Deactivating all the plugins was not helping at all. I’ve also tried a database repair of the litespeed plugin as suggested in another thread.

    I’ve checked a dozen of thread regarding this. Basically i can tell that there is not firewall issue. WAF is deactivate on Litespeed and on the Security Tab if granted access to ALL. I think that wordpress is blocking the request for some reasons, but i don’t know why. Looks like it needs a login on the wp-json/litespeed/v1/token
    the base wp-json/litespeed/v1/token is accessible.

    So please have a look on the HTACCESS:

    ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
    <IfModule LiteSpeed>
    RewriteEngine on
    CacheLookup on
    RewriteRule .* - [E=Cache-Control:no-autoflush]
    RewriteRule \.litespeed_conf\.dat - [F,L]
    ### marker MOBILE start ###
    RewriteCond %{HTTP_USER_AGENT} Mobile|Android|Silk/|Kindle|BlackBerry|Opera\ Mini|Opera\ Mobi [NC]
    RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+ismobile]
    ### marker MOBILE end ###
    ### marker CACHE RESOURCE start ###
    RewriteRule wp-content/.*/[^/]*(responsive|css|js|dynamic|loader|fonts)\.php - [E=cache-control:max-age=3600]
    ### marker CACHE RESOURCE end ###
    ### marker FAVICON start ###
    RewriteRule favicon\.ico$ - [E=cache-control:max-age=86400]
    ### marker FAVICON end ###
    ### marker DROPQS start ###
    CacheKeyModify -qs:fbclid
    CacheKeyModify -qs:gclid
    CacheKeyModify -qs:utm*
    CacheKeyModify -qs:_ga
    ### marker DROPQS end ###
    ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
    ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
    ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
    Header always set Strict-Transport-Security "max-age=31536000"
    # BEGIN WordPress
    # Die Anweisungen (Zeilen) zwischen „BEGIN WordPress“ und „END WordPress“ sind
    # dynamisch generiert und sollten nur über WordPress-Filter geändert werden.
    # Alle Änderungen an den Anweisungen zwischen diesen Markierungen werden überschrieben.
    # END WordPress

    Do you have any hint were I can continue with my investigations?

    Best Regards, Fabo

    • This topic was modified 2 years, 6 months ago by fabo137.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter fabo137


    Sorry forgot the report: SWKFDFFU

    Thread Starter fabo137


    I’ve made some further investigations. I still don’t have a solution, but an idea.

    I currently assuming that the lightspeed plugin, especially the function which is failing. I’ve found on src/cloud.cls.php the function public function token_validate() { which is doing the magic.

    This one is called by from the rest call and registered in

    		register_rest_route( 'litespeed/v1', '/token', array(
    			'methods' => 'POST',
    			'callback' => array( $this, 'token' ),
    			'permission_callback'	=> array( $this, 'is_from_cloud' ),

    which is making a check if ‘is from cloud’.

    which goes deeper in

    	public function is_from_cloud() {
    		if ( empty( $this->_summary[ 'ips' ] ) || empty( $this->_summary[ 'ips_ts' ] ) || time() - $this->_summary[ 'ips_ts' ] > 86400 * self::TTL_IPS ) {
    		$res = $this->cls( 'Router' )->ip_access( $this->_summary[ 'ips' ] );
    		if ( ! $res ) {
    			self::debug( '❌ Not our cloud IP' );
    			// Refresh IP list for future detection
    		else {
    			self::debug( '✅ Passed Cloud IP verification' );
    		return $res;

    and deeper in

    private function _update_ips() {
    		self::debug( 'Load remote Cloud IP list from ' . self::CLOUD_IPS );
    		$response = wp_remote_get( self::CLOUD_IPS . '?json' );
    		if ( is_wp_error( $response ) ) {
    			$error_message = $response->get_error_message();
    			self::debug( 'failed to get ip whitelist: ' . $error_message );
    			throw new \Exception( 'Failed to fetch QUIC.cloud whitelist ' . $error_message );
    		$json = json_decode( $response[ 'body' ], true );
    		$this->_summary[ 'ips_ts' ] = time();
    		$this->_summary[ 'ips' ] = $json;

    So i assume the plugin is checking if the origin IP from the caller is from quic cloud.

    That would explain the reason why I get a 401 when calling the API manually by just navigating to /wp-json/litespeed/v1/token. My IP is not from Cloud.

    And that brings me to the point that the calling IP from quic cloud to send back the key is failing because the rest api gets a wrong IP.

    I’ve mentioned before that I have whitelist the IPs. So the call will go definitely go through the ADC instance also through the webserver and hits the rest api.

    However authentication fails.

    So i’ve checked litespeed ADC config again and found in the Server – > GENERAL TAB a setting called: Use Client IP in Header which was set to NO.
    I’m not an Litespeed expert yet but would assume that my Webserver behind the ADC would not get the client IP. Instead I assume it will get the one of the ADC in the request header. …??? (I don’t know, I assume)

    So i’ve changed this setting to Trusted IPs so assuming ip will be forwarded in the header, because of the fact that quic cloud servers are in the trusted list.

    Was not working.

    I’ve found this setting on the Litespeed Webserver itself as well. Changed there as well. Also not working. So still not further.

    For completeness reasons here the whitelist IPs.,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

    So. No i’m really confused and disappointed. No idea how to continue, now idea how to fix this. A little hint would probably save my day. Thanks in advance for helping.

    Regards, Fabo

    • This reply was modified 2 years, 6 months ago by fabo137.
    • This reply was modified 2 years, 6 months ago by fabo137.
    Plugin Support qtwrk



    yes, when there is a proxy , like ADC or any other reverse proxy server in front , LSWS may not receive the real client IP

    you need to enable that client IP option to ON or trusted IP , in both LSWS and ADC

    a simple way to verify is that to create a phpinfo page , check the $_SERVER['REMOTE_ADDR'] , make sure it shows the visitor’s IP , instead of any proxy server IP

    Best regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Cannot Retrieve Domain Key’ is closed to new replies.