[MediaWiki-commits] [Gerrit] Normalize REST API Accept headers - change (operations/puppet)
BBlack has submitted this change and it was merged. Change subject: Normalize REST API Accept headers .. Normalize REST API Accept headers Per T124365, we are going to use `Accept` headers for response format negotiation. All relevant content-types will contain a profile parameter with a value pointing to https://www.mediawiki.org/wiki/Specs/, so we can use this property to normalize the Accept header without fragmenting on random Accept headers once we enable `Vary: Accept`. We might want to expand on this in the future to normalize spacing between parameters, and possibly remove the charset=utf-8; parameter. However, before adding that complexity we should see how many clients actually fail to copy & paste the expected content-type. Bug: T128040 Change-Id: I70f9ffad5770c8a6d35f28f59c8b17dc4a396910 --- M templates/varnish/text-common.inc.vcl.erb 1 file changed, 6 insertions(+), 0 deletions(-) Approvals: BBlack: Verified; Looks good to me, approved diff --git a/templates/varnish/text-common.inc.vcl.erb b/templates/varnish/text-common.inc.vcl.erb index 387dd80..ee608cf 100644 --- a/templates/varnish/text-common.inc.vcl.erb +++ b/templates/varnish/text-common.inc.vcl.erb @@ -65,6 +65,12 @@ } else { call normalize_mediawiki_path; } + + // Normalize Accept headers for the REST API: Ignore unless a profile is + // specified. + if (req.url ~ "^/api/rest_v1/" && req.http.Accept !~ "profile=\"https://www.mediawiki.org/wiki/Specs/;) { + unset req.http.Accept; + } } // fe+be common recv code -- To view, visit https://gerrit.wikimedia.org/r/281042 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I70f9ffad5770c8a6d35f28f59c8b17dc4a396910 Gerrit-PatchSet: 2 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: GWickeGerrit-Reviewer: BBlack Gerrit-Reviewer: Ema Gerrit-Reviewer: GWicke Gerrit-Reviewer: Mobrovac Gerrit-Reviewer: Ppchelko Gerrit-Reviewer: Subramanya Sastry Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Normalize REST API Accept headers - change (operations/puppet)
GWicke has uploaded a new change for review. https://gerrit.wikimedia.org/r/281042 Change subject: Normalize REST API Accept headers .. Normalize REST API Accept headers Per T124365, we are going to use `Accept` headers for response format negotiation. All relevant content-types will contain a profile parameter with a value pointing to https://www.mediawiki.org/wiki/Specs/, so we can use this property to normalize the Accept header without fragmenting on random Accept headers once we enable `Vary: Accept`. We might want to expand on this in the future to normalize spacing between parameters, and possibly remove the charset=utf-8; parameter. However, before adding that complexity we should see how many clients actually fail to copy & paste the expected content-type. Bug: T128040 Change-Id: I70f9ffad5770c8a6d35f28f59c8b17dc4a396910 --- M templates/varnish/text-common.inc.vcl.erb 1 file changed, 6 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/42/281042/1 diff --git a/templates/varnish/text-common.inc.vcl.erb b/templates/varnish/text-common.inc.vcl.erb index 044f58c..9836d9c 100644 --- a/templates/varnish/text-common.inc.vcl.erb +++ b/templates/varnish/text-common.inc.vcl.erb @@ -65,6 +65,12 @@ } else { call normalize_mediawiki_path; } + + // Normalize Accept headers for the REST API: Ignore unless a profile is + // specified. + if (req.url ~ "^/api/rest_v1/" && req.http.Accept !~ "profile=\"https://www.mediawiki.org/wiki/Specs/;) { + unset req.http.Accept; + } } // fe+be common recv code -- To view, visit https://gerrit.wikimedia.org/r/281042 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I70f9ffad5770c8a6d35f28f59c8b17dc4a396910 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: GWicke___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits