Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix EZP-24854: http cache purge bans wrong/additional location ids #1427

Merged

Conversation

joaoinacio
Copy link

JIRA: https://jira.ez.no/browse/EZP-24854

Problem

When issue http cache (varnish) purge requests, a regex is used with multiple location Ids.
The problem is that the regex is matching all locations that contain the value, for example, banning location 2 will also ban 12, 20, 21.

vcl ref: ban("obj.http.X-Location-Id ~ " + req.http.X-Location-Id);
https://github.com/ezsystems/ezplatform/blob/master/doc/varnish/vcl/varnish4.vcl#L116

Solution

Fix by making sure that location is one of the requested (starts/ends with provided value)

Tests

Manual

@andrerom
Copy link
Contributor

+1 (also for 5.4 backport, but that goes w/o saying)

@joaoinacio joaoinacio force-pushed the EZP-24854_varnish_ban_locations branch from d9bbe6d to 12353b4 Compare September 29, 2015 07:49
@glye
Copy link
Member

glye commented Sep 30, 2015

Not sure, but since $locationIds is an array, don't we need to sort() here to guarantee the tests will always pass? If irrelevant, kindly disregard this, and +1 from me.

@lolautruche
Copy link
Contributor

+1

@joaoinacio
Copy link
Author

@glye : as it is currently the ids are expected in the same order, if they are sorted (in purge client) then they would need to be sorted as well in tests (and unsorted/random in the data provider) - so AFAICT there wouldn't be much gain?

joaoinacio pushed a commit that referenced this pull request Sep 30, 2015
Fix EZP-24854: http cache purge bans wrong/additional location ids
@joaoinacio joaoinacio merged commit dbeefb6 into ezsystems:master Sep 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants