Skip to content

Commit 6a149da

Browse files
committed
osf: relay intended action to WB when asking for metadata
* Add a header to the WB metadata request indicating if this is in service of a render or export action. The OSF would like to keep metrics on render and export requests. MFR does not talk to the OSF directly but does fetch metadata from WB, which verifies auth with the OSF. MFR also downloads data from WB, but those requests will not be sent if MFR has cached the render/export output. The only request guaranteed to run is the metadata request. It's up to WB to interpret this and relay it to the OSF.
1 parent 3683895 commit 6a149da

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

mfr/providers/osf/provider.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ async def metadata(self):
6969
else:
7070
# URL is for WaterButler v1 API
7171
self.metrics.add('metadata.wb_api', 'v1')
72-
metadata_response = await self._make_request('HEAD', download_url)
72+
metadata_response = await self._make_request(
73+
'HEAD',
74+
download_url,
75+
headers={settings.MFR_ACTION_HEADER: self.action or ''}
76+
)
7377
response_code = metadata_response.status
7478
response_reason = metadata_response.reason
7579
response_headers = metadata_response.headers

mfr/providers/osf/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
config = settings.child('OSF_PROVIDER_CONFIG')
55

66
MFR_IDENTIFYING_HEADER = config.get('MFR_IDENTIFYING_HEADER', 'X-Cos-Mfr-Render-Request')
7+
MFR_ACTION_HEADER = config.get('MFR_ACTION_HEADER', 'X-Cos-Mfr-Request-Action')

0 commit comments

Comments
 (0)