Page MenuHomePhabricator

MCS doesn't set ETag if 'accept-encoding' header is provided.
Closed, ResolvedPublic

Description

This is crazy, but when I ask MCS for the content via curl I get back an etag header:

curl -i http://appservice.wmflabs.org/en.wikipedia.org/v1/page/mobile-sections/User%3APchelolo%2FAccess_Check_Tests

BUT when I query the same URL with preq I don't get an etag header back.

preq.get({
    uri: 'http://appservice.wmflabs.org/en.wikipedia.org/v1/page/mobile-sections/User%3APchelolo%2FAccess_Check_Tests',
}).then(function (res) {
    console.log(res.headers.etag);
});

The problem is that preq is setting an Accept-Encoding: gzip, deflate header, which curl doesn't. Apparently the response of the Mobile-Content-Service is dependent on that header which it shouldn't be.

In production that's not happening, so apparently it's been broken in beta labs recently. This is a blocker for MCS deployment, because RESTBase really needs these etags to be set since our access control is based on them for mobile content.

Event Timeline

Pchelolo renamed this task from MCS ETag weirness to MCS doesn't set ETag if 'accept-encoding' header is provided..Oct 18 2016, 9:19 PM
Pchelolo triaged this task as High priority.

And also since we are in the etag business, the etag format is "rev_id/uuid" (note the double quotes). MCS returns the etag without double quotes.

MCS has the latest master deployed, which means that both prod and labs MCS are at the exact same state. The difference here is that in labs, RB does not sit in between them, nor does Varnish, only nginx. Might it be that? Perhaps it's mangling the response and stripping the header off?

@mobrovac Ye, your theory is correct, it should be nginx, because directly querying the service from the node it's running on gives me back the etag. It's only left to find the labs nginx config..

MCS has the latest master deployed, which means that both prod and labs MCS are at the exact same state. The difference here is that in labs, RB does not sit in between them, nor does Varnish, only nginx. Might it be that? Perhaps it's mangling the response and stripping the header off?

This is the likely explanation. Using preq directly on the Labs node yields an ETag.

So, before T148676 is resolved, the only way to workaround this is to assign a public IP to the service and bypass the proxy. However, the labs MCS instance was created in services project and labs restbase instance is in deployment-prep project, we wouldn't be able to use the public IP in labs RESTBase, so the same bug would be there.

So, to workaround the issue completely and correctly, we need:

  • Move MCS labs to deployment-prep project
  • Point labs RESTBase to the local IP of MCS
  • Assign a public IP to the MCS service and point local RESTBase testing to it.

@bearND @Mholloway Any insight why was mobileapps located at the services project and not in deployment-prep?

I agree that MCS should be in BetaCluster as well. Originally, the MCS team wanted to be able to test the service directly with the app, so it made sense to put it in the services project. That instance auto-updates on each commit, so as to allow them to live test MCS. I think we should keep it that way.

The reason why we have not (yet) set it up in Beta is because, until recently, MCS didn't work for beta domains. Since now it does, we should add it to deployment-sca0[12] (where most of the other SCB services live in Beta). That means that the MCS team will need to be responsible for updating it every time they do a deploy.

As for the public IP, I think we should assign it to appservice.services.eqiad.wmflabs nevertheless, because that is the freshest version of MCS, which ensures that we test RB against the newest one every time.

Would we deploy by updating the deploy repo and using scap3, like we do for production?

Would we deploy by updating the deploy repo and using scap3, like we do for production?

You mean for BetaCluster? Yes, the procedure is the same, except it should happen from deployment-tin.deployment-prep.wmflabs.

Note that before you can actually deploy in Beta, we need to set it up - T149671: Set up MCS in BetaCluster

Does MCS need to do anything here? Is this dependent on MCS running in beta cluster?

Does MCS need to do anything here?

Yup, this:

And also since we are in the etag business, the etag format is "rev_id/uuid" (note the double quotes). MCS returns the etag without double quotes.

Is this dependent on MCS running in beta cluster?

No, but we do need to set it up there. Once the quotes are added to the ETag, we can resolve this.

Pchelolo claimed this task.

Resolving since the remaining piece is tracked by T150886 now.