我们的Ruby on Rails应用程序的一些用户抱怨说,页面请求偶尔会在Safari下无限期挂起(一对夫妇在Firefox下注意到它,但它绝大多数都是Safari用户).经过一些调查后,我们的Rails应用程序似乎正确地提供了这些请求,并且在获取HTML中引用的图像资源(托管在同一服务器上)时发生挂起.
我们已将Apache配置为直接为图像资源提供服务,并绕过Rails应用程序以提高性能.我们还在text/javascript/css资产上启用了gzip压缩.以下是我们的Apache虚拟主机配置中的相关设置 - 也许我们已经以这样的方式配置了这可以解释这些任意挂起请求?
RewriteEngine On
# Correct behaviour of IE under SSL
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
SSLEngine On
SSLCertificateFile /etc/httpd/conf/ssl/_.mycert.com.crt
SSLCertificateKeyFile /etc/httpd/conf/ssl/_. mycert.com.key
SSLCertificateChainFile /etc/httpd/conf/ssl/gd_bundle.crt
RequestHeader set X_ORIGINAL_PROTOCOL 'https'
RequestHeader set X_FORWARDED_PROTO 'https'
# Rewrite index to check for static
RewriteRule ^/$ /index.html [QSA]
RewriteRule "^/(images|stylesheets|javascripts|system)/?(.*)" "$0" [L]
# Rewrite to check for Rails cached page
RewriteRule ^([^.]+)$ $1.html [QSA]
# Deflate
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/x-javascript
BrowserMatch ^Mozilla/4 …Run Code Online (Sandbox Code Playgroud)