Fixing WordPress Login Issues After Configuring Baidu Cloud CDN

Baidu Cloud CDNWordPress login issueCDN configuration302 redirectcache settings
Published·Modified·

Background

The blog originally used Alibaba Cloud's Singapore node, but the 443 port was frequently blocked by ISPs, making the website inaccessible. Taking advantage of a Baidu Cloud promotion, I purchased a 500GB traffic package for 55 yuan and applied Baidu Cloud CDN (not Baidu Cloud Acceleration) to solve the problem. Initially, incorrect cache rules caused the WordPress backend to become inaccessible. This article records some important notes on configuring Baidu Cloud CDN for WordPress.

Configuring Cache Expiration Time

The WordPress backend consists of dynamic pages, so /wp-admin/ and .php dynamic files do not require caching. Set their expiration time to 0 seconds. Other cache expiration times can be adjusted based on your specific needs.

Disable Ignore Parameters

Baidu Cloud CDN has the "Ignore Parameters" feature enabled by default, which ignores parameters like ?xxx=. For dynamic programs like WordPress, this can cause significant issues, so this feature should be disabled.

Disable Follow 301/302 on Origin

When "Follow 301/302 on Origin" is enabled, if the origin node returns a 301/302 status code, the request will directly jump to fetch the resource without returning the 301/302 status to the user.

WordPress dynamically creates 302 status codes during the login process. If "Follow 301/302 on Origin" is enabled, normal redirection will fail. Therefore, this feature must be disabled.

Pay Attention to Origin Protocol

If your origin server uses HTTP, select HTTP for origin retrieval. If your origin server supports normal HTTPS access, select HTTPS for origin retrieval. Choosing the wrong origin protocol may lead to circular redirects. Since my blog's origin server has SSL deployed, I selected HTTPS for origin retrieval.

Pay Attention to Forced HTTPS Redirect in HTTPS Configuration

If your site has already deployed an SSL certificate and redirects port 80 to 443 (i.e., the origin server is set to redirect HTTP to HTTPS), there is no need to set "Forced HTTPS Redirect" on the CDN. Doing so may cause circular redirects.

Conclusion

With the above settings, the issue of being unable to log in to the WordPress backend can be resolved, serving as a reference for others. Additionally, improper CDN configuration not only fails to accelerate the site but can also cause anomalies. Therefore, configurations should be reasonable based on your specific business scenarios to avoid counterproductive results.