fastly-rails icon indicating copy to clipboard operation
fastly-rails copied to clipboard

Surrogate key length limit

Open gingermusketeer opened this issue 10 years ago • 4 comments

Surrogate keys have a limit of 1024 in length. See https://docs.fastly.com/guides/purging/how-do-i-set-a-surrogatekey-header-based-on-the-url

Going over this length was causing major issues for us and it was not easy to track down the cause.

Perhaps this gem should raise an exception if the surrogate key header is being set with a value longer than 1024

gingermusketeer avatar Mar 18 '15 21:03 gingermusketeer

Yea, it's unfortunate that you ran into this issue.

I'll talk to some folks internally about a good way of dealing with this; my main concern with adding it as an exception is in the event that the length requirements change in our purging ecosystem, and we forget to change it here; that will probably lead to even more confusion for folks.

Thanks for bringing this up.

set5think avatar Mar 18 '15 22:03 set5think

@set5think do you have news?

bpinto avatar Nov 14 '15 04:11 bpinto

A setting like the maxlength would be best but in the config/initializer to deal with change over time wouldn't it?

mrthan avatar Aug 01 '16 23:08 mrthan

One option would be to use hashed equivalents when we reach limits, like the Drupal plugin:

http://cgit.drupalcode.org/fastly/tree/src/EventSubscriber/SurrogateKeyGenerator.php?h=8.x-3.x http://cgit.drupalcode.org/fastly/tree/src/CacheTagsInvalidator.php?h=8.x-3.x

acme avatar Aug 02 '16 12:08 acme