| @@ -229,27 +229,36 @@ | ||
| 229 | 229 | // about") instead of the WARN the block deserves. |
| 230 | 230 | $inconclusive = $inconclusive && ! $refused; |
| 231 | 231 | |
| 232 | 232 | if ( Server::NGINX === $server_type ) { |
| 233 | - if ( $is_active ) { | |
| 234 | - $nginx_detail = 'nginx is serving cache hits directly — PHP bypassed (~5-15ms TTFB).'; | |
| 235 | - } elseif ( 'mobile_separate' === $block_reason ) { | |
| 236 | - $nginx_detail = 'nginx detected, but the static rewrite is disabled because Separate Mobile Cache is on.' . $mobile_block; | |
| 237 | - } elseif ( 'skipped_nonce' === $block_reason ) { | |
| 238 | - $nginx_detail = self::nonce_skip_detail( $skip ); | |
| 239 | - } elseif ( $inconclusive ) { | |
| 240 | - $nginx_detail = sprintf( | |
| 241 | - 'Could not verify the static rewrite — the check itself did not complete, so this is not evidence that your config is wrong. If you have already pasted the snippet, it may well be working. Reason: %s', | |
| 242 | - $probe_reason | |
| 243 | - ); | |
| 244 | - } else { | |
| 245 | - $nginx_detail = 'nginx detected but not yet routing to the cache. Paste the snippet below into your site\'s server { } block, then reload nginx.'; | |
| 233 | + // One verdict for both surfaces: this panel and the Site | |
| 234 | + // Health test must answer from the SAME ordering, or they | |
| 235 | + // drift apart again — the whole point of #480. | |
| 236 | + $verdict = \XSpeed\Modules\Health\HealthModule::nginx_rewrite_verdict( $probe, $block_reason ); | |
| 237 | + switch ( $verdict ) { | |
| 238 | + case 'active': | |
| 239 | + $nginx_detail = 'nginx is serving cache hits directly — PHP bypassed (~5-15ms TTFB).'; | |
| 240 | + break; | |
| 241 | + case 'mobile_separate': | |
| 242 | + $nginx_detail = 'nginx detected, but the static rewrite is disabled because Separate Mobile Cache is on.' . $mobile_block; | |
| 243 | + break; | |
| 244 | + case 'skipped_nonce': | |
| 245 | + $nginx_detail = self::nonce_skip_detail( $skip ); | |
| 246 | + break; | |
| 247 | + case 'unverified': | |
| 248 | + $nginx_detail = sprintf( | |
| 249 | + 'Could not verify the static rewrite — the check itself did not complete, so this is not evidence that your config is wrong. If you have already pasted the snippet, it may well be working. Reason: %s', | |
| 250 | + $probe_reason | |
| 251 | + ); | |
| 252 | + break; | |
| 253 | + default: // 'required'. | |
| 254 | + $nginx_detail = 'nginx detected but not yet routing to the cache. Paste the snippet below into your site\'s server { } block, then reload nginx.'; | |
| 246 | 255 | } |
| 247 | 256 | |
| 248 | 257 | $out[] = array( |
| 249 | 258 | 'id' => 'static_rewrite_nginx', |
| 250 | 259 | // Inconclusive is INFO, not WARN — we have no finding to warn about. |
| 251 | - 'tone' => $is_active ? self::OK : ( $inconclusive ? self::INFO : self::WARN ), | |
| 260 | + 'tone' => 'active' === $verdict ? self::OK : ( 'unverified' === $verdict ? self::INFO : self::WARN ), | |
| 252 | 261 | 'label' => 'Static-file rewrite (nginx server config)', |
| 253 | 262 | 'detail' => $nginx_detail, |
| 254 | 263 | // Always ship the snippet — even when active, so the |
| 255 | 264 | // admin has it handy for re-pasting after a server |