was wondering if you folks have faced this issue:
- I have an s3 bucket.
- I am uploading files directly to this bucket via uppy.
- I need to make a preflight request.
- I want to protect this preflight request so that only authenticated users can hit it.
mount Shrine.presign_endpoint(:cache) => “/s3/params”
# how does one ensure that uppy's options request are also handled? # the following causes some errors to return # match "s3/params", to: "presigns#file", via: [:get, :post, :put, :options] # am i doing this right? # presigns controller class PresignsController < ApplicationController def file set_rack_response FileUploader.presign_response(:cache, request.env) end private def set_rack_response((status, headers, body)) self.status = status self.headers.merge!(headers) self.response_body = body end end
Right now I am getting an error if I am protecting this endpoint using the code that is commented out above - rails is saying i have an invalid authenticity token Was wondering how you folks handle it?
Any pointers would be much appreciated.