Opened 4 months ago

Last modified 4 months ago

#26132 assigned defect

Fix the Expires header on relay search

Reported by: teor Owned by: metrics-team
Priority: Medium Milestone:
Component: Metrics/Onionoo Version:
Severity: Normal Keywords:
Cc: metrics-team Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Sometimes I get really stale (8 hours old) cached relay search pages. I think this happens because the page sets an Expires header in 1970. And I think my browser ignores that time, because it's before the Date header. Then it guesses that it can be cached for multiple hours.

Please set an accurate "Expires" header on relay search. You could set it to a few minutes after the scheduled time of the next Onionoo job. We could also add a max-age of slightly more than an hour.

Here is the relevant HTTP spec:
https://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.2.4

Child Tickets

Change History (8)

comment:1 Changed 4 months ago by teor

There is only one relay search page:
https://metrics.torproject.org/rs.html

I'm not sure what we can do to make sure that browsers refresh the page, because it's all done using anchors.

comment:2 Changed 4 months ago by irl

Data on relay search comes from Onionoo, which uses the Cache-Control: max-age= directive to instruct caches that data is stale after 15 minutes.

The rs.html page only changes when I make changes to it, it's not dynamically generated. I do see the Expires: header though and from some quick reading this appears to be added by Jetty and is not something we've done deliberately.

What browser is it you're using? Maybe it has broken caching. I'm attempting to reproduce in Firefox just now.

comment:3 Changed 4 months ago by irl

Owner: changed from metrics-team to irl
Status: newaccepted

comment:4 Changed 4 months ago by irl

Cc: metrics-team added

comment:5 Changed 4 months ago by irl

I've not been able to reproduce this in Firefox. Onionoo queries are repeated after 15 minutes without a refresh of the rs.html page.

comment:6 Changed 4 months ago by irl

Status: acceptedneeds_information

comment:7 in reply to:  2 Changed 4 months ago by teor

Replying to irl:

Data on relay search comes from Onionoo, which uses the Cache-Control: max-age= directive to instruct caches that data is stale after 15 minutes.

The rs.html page only changes when I make changes to it, it's not dynamically generated. I do see the Expires: header though and from some quick reading this appears to be added by Jetty and is not something we've done deliberately.

What browser is it you're using? Maybe it has broken caching. I'm attempting to reproduce in Firefox just now.

iOS MobileSafari. It tends to cache aggressively (particularly when its using mobile data?). And it might have broken caching in some edge cases.

comment:8 Changed 4 months ago by irl

Component: Metrics/Relay SearchMetrics/Onionoo
Owner: changed from irl to metrics-team
Status: needs_informationassigned

It looks like adding the must-revalidate header to Onionoo responses will fix this, assuming that mobile Safari honours it.

Servers SHOULD send the must-revalidate directive if and only if failure to revalidate a request on the entity could result in incorrect operation, such as a silently unexecuted financial transaction. Recipients MUST NOT take any automated action that violates this directive, and MUST NOT automatically provide an unvalidated copy of the entity if revalidation fails.

This does seem like an extreme step to take though. Safari should really be honouring the max-age= directive unless it has bad connectivity.

Reassigning to metrics-team as I won't have any more time to progress this week.

Note: See TracTickets for help on using tickets.