apache / apache/trafficserver

cachekey plugin throws error if remap based cachekey is configured

Open
#11,516 1 comment 0 reactions 1 assignee Claimed by @bryancall View on GitHub
Bug Cache Stale
Dominant language
C++
Stars
2k
Forks
874
Avg merge
6d 15h
Merged PRs (30d)
46

Description

We are in a situation where we have some remap rules configured that include cookies in the cachekey for specific domains.

Since we do not want to place a cachekey configuration to each remap rule, we also have the global plugin config.

`plugin.config`
```
cachekey.so --sort-params=true --uri-type=pristine
```

`remap.config`

```
map https://www.exaple.org/ https://origin.example.org/ @plugin=header_rewrite.so @pparam=dscp/set_dscp_0.config @plugin=cachekey.so @pparam=--uri-type=remap @pparam=--sort-params=true @pparam=--include-cookies=testcookie1
```

Technically this seems to work fine, but causes an error in the `diags.log` on each request that matches the rule:

```
[Jul 8 15:15:22.654] [ET_NET 0] ERROR: (cachekey) failed to set cache key for url https://origin.example.org/
```

Shouldn't this be just an informational log entry, since it just means that the remap rule already set the cachekey and therefore the global rule has no effect anymore? This part of the code seems to cause the log entry:

https://github.com/apache/trafficserver/blob/master/plugins/cachekey/cachekey.cc#L762

Here's the full debug log:

```
Jul 08 13:28:58 server1.example.org traffic_manager[925740]: [Jul 8 13:28:58.648] [ET_NET 16] DIAG: (cachekey) cachekey/cachekey.cc:253:CacheKey() setting cache key from a remap plugin
Jul 08 13:28:58 server1.example.org traffic_manager[925740]: [Jul 8 13:28:58.648] [ET_NET 16] DIAG: (cachekey) cachekey/cachekey.cc:262:CacheKey() using pristine uri 'https://www.example.org/'
Jul 08 13:28:58 server1.example.org traffic_manager[925740]: [Jul 8 13:28:58.648] [ET_NET 16] DIAG: (cachekey) cachekey/cachekey.cc:425:appendPrefix() added default prefix, key: '/www.example.org/443'
Jul 08 13:28:58 server1.example.org traffic_manager[925740]: [Jul 8 13:28:58.648] [ET_NET 16] DIAG: (cachekey) cachekey/configs.cc:162:toBeAdded() cookie 'testcookie1' does not match the 'exclude' rule
Jul 08 13:28:58 server1.example.org traffic_manager[925740]: [Jul 8 13:28:58.648] [ET_NET 16] DIAG: (cachekey) cachekey/configs.cc:167:toBeAdded() cookie 'testcookie1' matches the 'include' rule
Jul 08 13:28:58 server1.example.org traffic_manager[925740]: [Jul 8 13:28:58.648] [ET_NET 16] DIAG: (cachekey) cachekey/configs.cc:170:toBeAdded() cookie 'testcookie1' should be added to cache key
Jul 08 13:28:58 server1.example.org traffic_manager[925740]: [Jul 8 13:28:58.648] [ET_NET 16] DIAG: (cachekey) cachekey/cachekey.cc:752:finalize() finalizing cache key '/www.example.org/443/testcookie1=somevalue1' from a rem>
Jul 08 13:28:58 server1.example.org traffic_manager[925740]: [Jul 8 13:28:58.648] [ET_NET 16] DIAG: (cachekey) cachekey/cachekey.cc:800:finalize() set cache key to /www.example.org/443/testcookie1=somevalue1
Jul 08 13:28:58 server1.example.org traffic_manager[925740]: [Jul 8 13:28:58.648] [ET_NET 16] DIAG: (cachekey) cachekey/cachekey.cc:253:CacheKey() setting cache key from a global plugin
Jul 08 13:28:58 server1.example.org traffic_manager[925740]: [Jul 8 13:28:58.648] [ET_NET 16] DIAG: (cachekey) cachekey/cachekey.cc:282:CacheKey() using pristine uri 'https://www.example.org/'
Jul 08 13:28:58 server1.example.org traffic_manager[925740]: [Jul 8 13:28:58.648] [ET_NET 16] DIAG: (cachekey) cachekey/cachekey.cc:425:appendPrefix() added default prefix, key: '/www.example.org/443'
Jul 08 13:28:58 server1.example.org traffic_manager[925740]: [Jul 8 13:28:58.648] [ET_NET 16] DIAG: (cachekey) cachekey/cachekey.cc:752:finalize() finalizing cache key '/www.example.org/443' from a global plugin
Jul 08 13:28:58 server1.example.org traffic_manager[925740]: [Jul 8 13:28:58.648] [ET_NET 16] DIAG: (cachekey) cachekey/cachekey.cc:808:finalize() failed to set cache key for url https://origin.example.org/
```

Is it possible to supress this "error" message?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.