I’m trying to log downloads of CarrierWave resources hosted at S3, so I have a
controller method that performs a redirect to the remote_url, and creates a new
database record to store the request details. But when I access this endpoint
with Safari, I am seeing a strange double log for the request. Here’s what the
request looks like in the logs:
I, [2015-08-09T18:22:01.463646 #44996] INFO -- : Started GET
"/sources/28803-facsimile-pdf-cobbett-selections-from-cobbetts-political-works-vol-2/download"
for 173.161.197.5 at 2015-08-09 18:22:01 +0000
I, [2015-08-09T18:22:01.465244 #44996] INFO -- : Processing by
SourcesController#download as HTML
I, [2015-08-09T18:22:01.465311 #44996] INFO -- : Parameters:
{"id"=>"28803-facsimile-pdf-cobbett-selections-from-cobbetts-political-works-vol-2"}
I, [2015-08-09T18:22:01.468033 #44996] INFO -- : Redirected to
http://lf-oll.s3.amazonaws.com/titles/2689/Cobbett_1627-02_Bk.pdf
I, [2015-08-09T18:22:01.471834 #44996] INFO -- : Completed 403 Forbidden in
6ms (ActiveRecord: 1.1ms)
I, [2015-08-09T18:22:01.690815 #44996] INFO -- : Started GET
"/sources/28803-facsimile-pdf-cobbett-selections-from-cobbetts-political-works-vol-2/download"
for 173.161.197.5 at 2015-08-09 18:22:01 +0000
I, [2015-08-09T18:22:01.692262 #44996] INFO -- : Processing by
SourcesController#download as HTML
I, [2015-08-09T18:22:01.692324 #44996] INFO -- : Parameters:
{"id"=>"28803-facsimile-pdf-cobbett-selections-from-cobbetts-political-works-vol-2"}
I, [2015-08-09T18:22:01.694572 #44996] INFO -- : Redirected to
http://lf-oll.s3.amazonaws.com/titles/2689/Cobbett_1627-02_Bk.pdf
I, [2015-08-09T18:22:01.697804 #44996] INFO -- : Completed 302 Found in 5ms
(ActiveRecord: 1.2ms)
And the result is two rows in my database, one for the 403, and the other for
the 302.
My suspicion is that Safari is doing some introspection on the file to
determine its file type, since I know that it doesn’t trust headers. Does
anyone have any other ideas?
Thanks,
Walter
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/C58A1B05-CF63-4B97-B170-5360A6639683%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.