While making a patch recently, I noticed this bit of code in compute_asset_host
:
elsif host.include?("%d")
host = host % (Zlib.crc32(source) % 4)
This feature was added 15 years ago because of limitations in the amount of simultaneous connections browsers would use per domain.
Modern browsers no longer suffer from this limitation, and using several domains for assets requires additional DNS resolution, so it’s likely that using this feature no longer has a positive impact in performance (perhaps the opposite).
The question is, would it make sense to drop this feature now?
Willing to make a PR if that’s the case, but perhaps there are concerns around backwards compatibility that I’m missing.
Since asset_host
can be a Proc
, users that really need this behavior today could apply this logic manually.