Fix EZP-24854: http cache purge bans wrong/additional location ids #1427
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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