Бесконечный redirect (infinite redirect loop)
-
Решил поставить wordpress на хостинг и столкнулся со следующей проблемой. При обращении непосредственно к блогу, например, https://www.example.com/, wordpress впадает в бесконечный цикл — отправляет 301 redirect (браузер выдает ошибку ERR_TOO_MANY_REDIRECT).
Схема хостинга выглядит следующим образом:
USER BROWSER — HTTPS — CLOUDFLARE — HTTPS — NGINX — HTTP — APACHE
Подключил php debug_trace на функцию wp-redirect и не могу понять, в чем косяк, может быть кто-нибудь подскажет?
Sat, 15 Apr 2017 23:38:20 +0000 IP: 127.0.0.1 Location: [https://www.example.com/], Status [301] Backtrace array ( 0 => array ( 'file' => '/opt/example.com/html/wp-includes/class-wp-hook.php', 'line' => 298, 'function' => 'orb_dbg_redirect_trbl', 'args' => array ( 0 => 'https://www.example.com/', 1 => 301, ), ), 1 => array ( 'file' => '/opt/example.com/html/wp-includes/plugin.php', 'line' => 203, 'function' => 'apply_filters', 'class' => 'WP_Hook', 'object' => WP_Hook::__set_state(array( 'callbacks' => array ( 1 => array ( '000000005c052acc000000000897bca8wp_redirect' => array ( 'function' => array ( 0 => WordPress_Module::__set_state(array( 'matched' => false, )), 1 => 'wp_redirect', ), 'accepted_args' => 2, ), ), 100 => array ( 'orb_dbg_redirect_trbl' => array ( 'function' => 'orb_dbg_redirect_trbl', 'accepted_args' => 2, ), ), ), 'iterations' => array ( 0 => array ( 0 => 1, 1 => 100, ), ), 'current_priority' => array ( 0 => 100, ), 'nesting_level' => 1, 'doing_action' => false, )), 'type' => '->', 'args' => array ( 0 => 'https://www.example.com/', 1 => array ( 0 => 'https://www.example.com/', 1 => 301, ), ), ), 2 => array ( 'file' => '/opt/example.com/html/wp-includes/pluggable.php', 'line' => 1159, 'function' => 'apply_filters', 'args' => array ( 0 => 'wp_redirect', 1 => 'https://www.example.com/', 2 => 301, ), ), 3 => array ( 'file' => '/opt/example.com/html/wp-includes/canonical.php', 'line' => 516, 'function' => 'wp_redirect', 'args' => array ( 0 => 'https://www.example.com/', 1 => 301, ), ), 4 => array ( 'file' => '/opt/example.com/html/wp-includes/class-wp-hook.php', 'line' => 298, 'function' => 'redirect_canonical', 'args' => array ( 0 => 'https://www.example.com/index.php', ), ), 5 => array ( 'file' => '/opt/example.com/html/wp-includes/class-wp-hook.php', 'line' => 323, 'function' => 'apply_filters', 'class' => 'WP_Hook', 'object' => WP_Hook::__set_state(array( 'callbacks' => array ( 0 => array ( '_wp_admin_bar_init' => array ( 'function' => '_wp_admin_bar_init', 'accepted_args' => 1, ), ), 10 => array ( 'redirect_canonical' => array ( 'function' => 'redirect_canonical', 'accepted_args' => 1, ), '000000005c052acc000000000897bca8template_redirect' => array ( 'function' => array ( 0 => WordPress_Module::__set_state(array( 'matched' => false, )), 1 => 'template_redirect', ), 'accepted_args' => 1, ), ), 11 => array ( 'rest_output_link_header' => array ( 'function' => 'rest_output_link_header', 'accepted_args' => 0, ), 'wp_shortlink_header' => array ( 'function' => 'wp_shortlink_header', 'accepted_args' => 0, ), ), 20 => array ( 'wpcf7_cleanup_upload_files' => array ( 'function' => 'wpcf7_cleanup_upload_files', 'accepted_args' => 1, ), 'wpcf7_cleanup_captcha_files' => array ( 'function' => 'wpcf7_cleanup_captcha_files', 'accepted_args' => 1, ), ), 1000 => array ( 'wp_redirect_admin_locations' => array ( 'function' => 'wp_redirect_admin_locations', 'accepted_args' => 1, ), ), ), 'iterations' => array ( 0 => array ( 0 => 0, 1 => 10, 2 => 11, 3 => 20, 4 => 1000, ), ), 'current_priority' => array ( 0 => 10, ), 'nesting_level' => 1, 'doing_action' => true, )), 'type' => '->', 'args' => array ( 0 => false, 1 => array ( 0 => '', ), ), ), 6 => array ( 'file' => '/opt/example.com/html/wp-includes/plugin.php', 'line' => 453, 'function' => 'do_action', 'class' => 'WP_Hook', 'object' => WP_Hook::__set_state(array( 'callbacks' => array ( 0 => array ( '_wp_admin_bar_init' => array ( 'function' => '_wp_admin_bar_init', 'accepted_args' => 1, ), ), 10 => array ( 'redirect_canonical' => array ( 'function' => 'redirect_canonical', 'accepted_args' => 1, ), '000000005c052acc000000000897bca8template_redirect' => array ( 'function' => array ( 0 => WordPress_Module::__set_state(array( 'matched' => false, )), 1 => 'template_redirect', ), 'accepted_args' => 1, ), ), 11 => array ( 'rest_output_link_header' => array ( 'function' => 'rest_output_link_header', 'accepted_args' => 0, ), 'wp_shortlink_header' => array ( 'function' => 'wp_shortlink_header', 'accepted_args' => 0, ), ), 20 => array ( 'wpcf7_cleanup_upload_files' => array ( 'function' => 'wpcf7_cleanup_upload_files', 'accepted_args' => 1, ), 'wpcf7_cleanup_captcha_files' => array ( 'function' => 'wpcf7_cleanup_captcha_files', 'accepted_args' => 1, ), ), 1000 => array ( 'wp_redirect_admin_locations' => array ( 'function' => 'wp_redirect_admin_locations', 'accepted_args' => 1, ), ), ), 'iterations' => array ( 0 => array ( 0 => 0, 1 => 10, 2 => 11, 3 => 20, 4 => 1000, ), ), 'current_priority' => array ( 0 => 10, ), 'nesting_level' => 1, 'doing_action' => true, )), 'type' => '->', 'args' => array ( 0 => array ( 0 => '', ), ), ), 7 => array ( 'file' => '/opt/example.com/html/wp-includes/template-loader.php', 'line' => 12, 'function' => 'do_action', 'args' => array ( 0 => 'template_redirect', ), ), 8 => array ( 'file' => '/opt/example.com/html/wp-blog-header.php', 'line' => 19, 'args' => array ( 0 => '/opt/example.com/html/wp-includes/template-loader.php', ), 'function' => 'require_once', ), 9 => array ( 'file' => '/opt/example.com/html/index.php', 'line' => 17, 'args' => array ( 0 => '/opt/example.com/html/wp-blog-header.php', ), 'function' => 'require', ), )
Результат проверки плагином на совместимость с SSL:
Array ( [HTTPS] => on [HTTP_X_FORWARDED_PROTO] => https [HTTP_X_REAL_IP] => XX.XXX.XXX.XXX [HTTP_X_FORWARDED_FOR] => XX.XXX.XXX.XXX [HTTP_X_SCHEME] => https [HTTP_CF_IPCOUNTRY] => RU [HTTP_CF_RAY] => XXXXXXXXXXX-LHR [HTTP_CF_VISITOR] => {"scheme":"https"} [HTTP_X_COMPRESS] => null [HTTP_CF_CONNECTING_IP] => XX.XXX.XXX.XXX [REQUEST_SCHEME] => http )
правила mod_rewrite:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
PS: Админка доступна. Инсталляция свежая (практически без plug’инов, пробовал доставить SSL плагин и cloudflare, но это не решило проблему).
- Тема «Бесконечный redirect (infinite redirect loop)» закрыта для новых ответов.