Giuseppe Lavagetto has submitted this change and it was merged.
Change subject: RESTBase: Strip redundant headers from back-end services
......................................................................
RESTBase: Strip redundant headers from back-end services
When RESTBase stores and returns responses from back-end services, such
as Mathoid and MobileApps, it stores and passes along all of the headers.
However, some pertain only to RESTBase's request, not the client.
Headers such as content-encoding and content-length should be stripped
away from responses, since RESTBase sets its own.
Bug: T116911
Change-Id: I0b09be9163428fe6390eb238e316ebe30859e84e
---
M modules/restbase/templates/config.labs.yaml.erb
M modules/restbase/templates/config.yaml.erb
2 files changed, 8 insertions(+), 8 deletions(-)
Approvals:
Giuseppe Lavagetto: Verified; Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/restbase/templates/config.labs.yaml.erb
b/modules/restbase/templates/config.labs.yaml.erb
index d238ab2..e7e28f7 100644
--- a/modules/restbase/templates/config.labs.yaml.erb
+++ b/modules/restbase/templates/config.labs.yaml.erb
@@ -294,11 +294,11 @@
headers:
content-type: application/json
body:
- headers: '{$.get_mobileapps.headers}'
+ headers: '{$$.strip($.get_mobileapps.headers,
["content-length", "content-encoding"])}'
body: '{$.get_mobileapps.body}'
return:
status: 200
- headers: '{$.get_mobileapps.headers}'
+ headers: '{$$.strip($.get_mobileapps.headers,
["content-length", "content-encoding"])}'
body: '{$.get_mobileapps.body}'
/handling/content/{cache-default}/{route}/{title}:
post:
@@ -418,11 +418,11 @@
headers:
content-type: application/json
body:
- headers: '{$$.merge($.mathoid.headers,
{"x-resource-location": $.request.headers.x-resource-location})}'
+ headers: '{$$.merge($$.strip($.mathoid.headers,
["content-length", "content-encoding"]), {"x-resource-location":
$.request.headers.x-resource-location})}'
data: '{$.mathoid.body}'
return:
status: 200
- headers:
'{$$.merge($.mathoid.body[$.request.params.format].headers,$$.merge($.mathoid.headers,
{"x-resource-location": $.request.headers.x-resource-location}))}'
+ headers:
'{$$.merge($.mathoid.body[$.request.params.format].headers,$$.merge($$.strip($.mathoid.headers,
["content-length", "content-encoding"]), {"x-resource-location":
$.request.headers.x-resource-location}))}'
body: '{$.mathoid.body[$.request.params.format].body}'
/{module:pageviews}/per-article/{+rest}:
diff --git a/modules/restbase/templates/config.yaml.erb
b/modules/restbase/templates/config.yaml.erb
index 8624fd1..8b6e0a5 100644
--- a/modules/restbase/templates/config.yaml.erb
+++ b/modules/restbase/templates/config.yaml.erb
@@ -311,11 +311,11 @@
headers:
content-type: application/json
body:
- headers: '{$.get_mobileapps.headers}'
+ headers: '{$$.strip($.get_mobileapps.headers,
["content-length", "content-encoding"])}'
body: '{$.get_mobileapps.body}'
return:
status: 200
- headers: '{$.get_mobileapps.headers}'
+ headers: '{$$.strip($.get_mobileapps.headers,
["content-length", "content-encoding"])}'
body: '{$.get_mobileapps.body}'
/handling/content/{cache-default}/{route}/{title}:
post:
@@ -435,11 +435,11 @@
headers:
content-type: application/json
body:
- headers: '{$$.merge($.mathoid.headers,
{"x-resource-location": $.request.headers.x-resource-location})}'
+ headers: '{$$.merge($$.strip($.mathoid.headers,
["content-length", "content-encoding"]), {"x-resource-location":
$.request.headers.x-resource-location})}'
data: '{$.mathoid.body}'
return:
status: 200
- headers:
'{$$.merge($.mathoid.body[$.request.params.format].headers,$$.merge($.mathoid.headers,
{"x-resource-location": $.request.headers.x-resource-location}))}'
+ headers:
'{$$.merge($.mathoid.body[$.request.params.format].headers,$$.merge($$.strip($.mathoid.headers,
["content-length", "content-encoding"]), {"x-resource-location":
$.request.headers.x-resource-location}))}'
body: '{$.mathoid.body[$.request.params.format].body}'
/{module:pageviews}/per-article/{+rest}:
--
To view, visit https://gerrit.wikimedia.org/r/249465
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0b09be9163428fe6390eb238e316ebe30859e84e
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Mobrovac <[email protected]>
Gerrit-Reviewer: Alexandros Kosiaris <[email protected]>
Gerrit-Reviewer: Eevans <[email protected]>
Gerrit-Reviewer: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits