A few of the customers in our Ruby on Rails application have complained that page demands from time to time hang indefinitely under Safari (a few have observed it under Opera, but it is extremely Safari customers). After a little analysis it appears these demands are now being offered properly by our Rails application and also the hang happens when fetching image assets (that are located on a single server) that are recommended within the HTML.

We now have set up Apache for everyone the look assets directly and bypass the Rails application for performance. We now have also enabled gzip compression on text/javascript/css assets. Here are the appropriate configurations from your Apache Virtual Host configuration -- possibly we now have set up this in a way that might explain these arbitrary hanging demands?

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 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

ExpiresActive On
<FilesMatch "\.(ico|gif|jpe?g|png|js|css)$">
  ExpiresDefault "access plus 1 year"
  Header append Cache-Control "public"

Has anybody experienced an identical problem before?

Our Ruby on Rails web application is run on mod_rails and Apache 2.2.3 on RedHat Enterprise Linux 5.

Update: I've now attempted getting rid of the next block and also the problem still continues, therefore it appears like we are able to exclude the expires header from being the issue:

ExpiresActive On
<FilesMatch "\.(ico|gif|jpe?g|png|js|css)$">
  ExpiresDefault "access plus 1 year"
  Header append Cache-Control "public"


This might be related, but browsers possess a limit of two (automatically) synchronised connections that they'll make. If you will find connections stored open for communication, and you're simply also fetching images, the phone call towards the image might not undergo up until the browser has among its stipulated connections free. The concept throughout image fetch may really be triggered by another server connections which aren't finishing or are now being held open through the server and browser. To really be hunting within the wrong place.

If you can to breed the mistake, try switching to HTTP 1. in your dev server and find out whether it fixes the problem. Likewise try moving a few of the assets to a different domain/subdomain and fetch after that.

Hope that provides you another position.

Regards, Narayan