Typecho HTTPS cannot log in to the background

Typecho HTTPS cannot log in to the background

Address of this article: blog.lucien.ink/archives/523

background

Because the HTTPS certificate of Baidu Cloud Acceleration is difficult to use, the CDN solution of the blog has recently been migrated to Cloud Flare.

In addition, the SSL renewal of the pagoda has various ghosts after a certain version. For convenience, I directly chose half-pass encryption, that is, [用户] -- HTTPS --> [Cloud Flare] -- HTTP --> [Server] .

Immediately, I found a problem. Typecho’s background cannot be logged in. The specific performance is that after the login jump, it still stays on the login interface.

solution

I found the corresponding solution on GitHub , edit the file config.inc.php in the root directory of the Typecho site, and add a line define('__TYPECHO_SECURE__',true); at the end.

The cause of the problem I guess is because the user and the browser are interacting with HTTPS, but in fact, what PHP receives is the HTTP interaction from Cloud Flare, so PHP uses HTTP to respond, combined with some features of Typecho to form this problem.

This article is reprinted from: https://blog.lucien.ink/archives/523/
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment