apache - 非常慢的 https 重定向 - 加载时间增加 10 秒

标签 apache ssl redirect https

由于 ssl 重定向,我经历了长达 12 秒的等待时间。我已经尝试了很多事情,但似乎无法弄清楚为什么。使用“www.thesoapopera.com”时似乎最糟糕。

www.thesoapopera.com 将近 12 秒: https://tools.pingdom.com/#!/BBsdZ/www.thesoapopera.com

1.13 秒完整 https://www.thesoapopera.com : https://tools.pingdom.com/#!/cPx3LD/https://www.thesoapopera.com

几乎背靠背测试,网站加载时间延长了 10 秒!这是我的 htaccess 文件:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# BEGIN WpFastestCache
# Start WPFC Exclude
# End WPFC Exclude
# Start_WPFC_Exclude_Admin_Cookie
RewriteCond %{HTTP:Cookie} 
!wordpress_logged_in_[^\=]+\=aacc|aaWoocommerce|acd4494|KenzieTrezise|Luna
RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=Sean|Stacey|Steppe
# End_WPFC_Exclude_Admin_Cookie
RewriteCond %{HTTP_HOST} ^www.thesoapopera.com
RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|WhatsApp|Mediatoolkitbot)
RewriteCond %{HTTP_USER_AGENT} ! 
(WP\sFastest\sCache\sPreload(\siPhone\sMobile)?\s*Bot)
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{REQUEST_URI} !(\/){2}$
RewriteCond %{REQUEST_URI} \/$
RewriteCond %{QUERY_STRING} !.+
RewriteCond %{HTTP:Cookie} !wordpress_logged_in
RewriteCond %{HTTP:Cookie} !comment_author_
RewriteCond %{HTTP:Cookie} !wp_woocommerce_session
RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/all/$1/index.html -f [or]
RewriteCond /home/spscannell/public_html/wp-content/cache/all/$1/index.html -f
RewriteRule ^(.*) "/wp-content/cache/all/$1/index.html" [L]
</IfModule>
<FilesMatch "index\.(html|htm)$">
AddDefaultCharset UTF-8
<ifModule mod_headers.c>
FileETag None
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Mon, 29 Oct 1923 20:30:00 GMT"
</ifModule>
</FilesMatch>
# END WpFastestCache
# BEGIN GzipWpFastestCache
<IfModule mod_deflate.c>
AddType x-font/woff .woff
AddType x-font/ttf .ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE font/opentype font/ttf font/eot font/otf
</IfModule>
# END GzipWpFastestCache
# BEGIN WEBPWpFastestCache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_URI} \.(jpe?g|png)
RewriteCond %{DOCUMENT_ROOT}/$1.webp -f [or]
RewriteCond /home/spscannell/public_html/$1.webp -f
RewriteRule ^(.*) "/$1.webp" [L]
</IfModule>
<IfModule mod_headers.c>
Header append Vary Accept env=REDIRECT_accept
</IfModule>
AddType image/webp .webp
# END WEBPWpFastestCache
# BEGIN LBCWpFastestCache
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|webp|js|css|swf|x-html|css|xml|js|woff|woff2|ttf|svg|eot)(\.gz)?$">
<IfModule mod_expires.c>
AddType application/font-woff2 .woff2
ExpiresActive On
ExpiresDefault A0
ExpiresByType image/webp A2592000
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/ico A2592000
ExpiresByType image/svg+xml A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
ExpiresByType application/javascript A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType application/font-woff2 A2592000
</IfModule>
<IfModule mod_headers.c>
Header set Expires "max-age=2592000, public"
Header unset ETag
Header set Connection keep-alive
FileETag None
</IfModule>
</FilesMatch>
# END LBCWpFastestCache

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
# BEGIN EWWWIO

# END EWWWIO

# BEGIN cPanel-generated php ini directives, do not edit
# Manual editing of this file may result in unexpected behavior.
# To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
# For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
<IfModule php7_module>
   php_flag display_errors Off
   php_value max_execution_time 90
   php_value max_input_time 60
   php_value max_input_vars 1000
   php_value memory_limit 512M
   php_value post_max_size 8M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/ea-php70"
   php_value upload_max_filesize 64M
   php_flag zlib.output_compression Off
</IfModule>
# END cPanel-generated php ini directives, do not edit

最佳答案

如果直接访问 https:// 站点,则不会发送任何 cookie,并且响应相对较小:只有 20KByte。在访问 http:// 的情况下,该站点提供一个 cookie,然后在重定向到 https:// 站点时发送该 cookie,从而导致更大的响应121 字节。

我的猜测是,如果发送 session cookie,应用程序逻辑会进行大量数据库查找,这会导致创建响应所需的时间更长,而且内容也会不同且更大。此外,您还可以看到 https:// 版本仅产生 50 个请求,而 http:// 版本产生 77 个请求,即完成了更多请求(可能是因为提供的内容不同),这也会影响性能。

关于apache - 非常慢的 https 重定向 - 加载时间增加 10 秒,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49578076/

相关文章:

php: SQLSTATE[HY000] [2002] 由于目标机器主动拒绝而无法建立连接

java - 302重定向后的HTTP Referer

python - 获取 admin_only 装饰器的重定向循环

ruby - 使用 ruby​​ mechanize 检测重定向

amazon-web-services - Amazon EC2 上的 HTTPS 证书

apache - 为什么 WSGIScriptAlias 没有效果?

apache - Centos6 - Apache |子域不工作

linux - 我可以在网络主机上上传文件名包含 "*"字符的文件吗?

php - 从 PHP 发送电子邮件时使用 SSL/TLS

python3.8 virtualenv pip没有升级