I am using Strapi V4 as my CMS and using ECS S3 as the media storage.
I am using https://www.npmjs.com/package/#strapi/provider-upload-aws-s3 as the provider upload plugin.
I am able to upload media assets to the bucket but get error 403 forbidden when I try to GET the assets from the bucket.
I have done the necessary additions to plugins.js and middlewares.js files.
I am now trying to add a parameter "x-emc-namespace": "my-bucket-key" to the request header in the HTTPS call that Strapi API makes to the bucket.
I have tried the Strapi webhooks approach mentioned here but that didn't help in adding a parameter to the request header.
So, my question is how to add a parameter in the Strapi v4 request header.
Related
I was looking for better ways to implement s3 presigned URL. As if the page contains 50 object which are stored in private bucket. You need to hit 50 API calls to fetch presigned URL from frontend.
https://www.dropbox.com/s/l9wnoxly1wbnn5z/redirect.mov?dl=0
A video for the same can be found on above link, how bitbucket is handling this. Which seems pretty cool. As no API are hit and also URL provided from API is fixed & clean
I'm trying to make a photo gallery app that gets its photos from an S3 bucket. The images are fetched through presigned urls. The problem is that when I use the Image component from Next, I get the following error: "url" parameter is valid but upstream response is invalid. I can't seem to find the problem. I already configured the domain in the next.config.js file.
I found the solution: Upgrade Next.js
I'm using API platform with VichBundle to store file on the back side and React Native on the Front side.
I've followed the documentation of API platform and the upload part is working well, but I don't know how to download the document.
When I make a GET request I have the entity with the url of the file but I can't do a GET request with this url because there is no route to this file.
Can somebody give me an exemple of how to download file with api platform and Vichbundle.
Thanks
If you are following Api Platfom's documentation your files should be uploaded to your project's ./app/public/media/ folder and available making an HTTP GET request to http(s)://<yourdomain>/public/media/<filename>.<extension>. Just open the URL in your browser.
To get the exact url query yout API for me mediaObject information (for example, /api/media_objects/{id}) and check the contentUrl property.
I have files in an S3 bucket that I am serving using AWS API Gateway
I have a resource GET /{file} that maps to mybucket:/{file}
ie http://myapigateway.com/test1.txt correctly returns mybucket:/test1.txt
Now I want to serve files with directory paths:
http://myapigateway.com/dirA/test2.txt should return the file mybucket:/dirA/test2.txt
I can not get this to work. The problem is that when I set the new API Gateway resource to use greedy path matches as a "proxy resource":
GET /{proxy+}
I no longer have the option to integrate with s3 (see image below)
I tried to pass the method.request.querystring.proxy var instead of method.request.path.proxy to prevent the slashes from being stripped but that didn't help.
If I can't integrate with s3 directly, is there any way I can work-around with a lambda function?
screen-shot: no option to integrate with AWS Service
I am using AWS S3 static web hosting for my VueJs SPA app. I have setup routing rules in S3 and it works perfectly fine when I access it using S3 static hosting url. But, I also have configured CloudFront to use it with my custom domain. Since single page apps need to be routed via index.html, I have setup custom error page in cloudfront to redirect 404 errors to index.html. So now routing rules I have setup in S3 no longer works.
What is the best way to get S3 routing rules to work along with CloudFront custom error page setup for SPA?
I think I am a bit late but here goes anyway,
Apparently you can't do that if you are using S3 REST_API endpoints (example-bucket.s3.amazonaws.com) as your origin for your CloudFront distribution, you have to use the S3 website url provided by S3 as the origin (example-bucket.s3-website-[region].amazonaws.com). Also, objects must be public you can't lock your bucket to the distribution by origin policy.
So,
Objects must be public.
S3 bucket website option must be turned on.
Distribution origin has to come from the S3 website url, not the rest api endpoint.
EDIT:
I was mistaking, actually, you can do it with the REST_API endpoint too, you only have to create a Custom Error Response inside your CloudFront distribution, probably only for the 404 and 403 error codes, set the "Customize Error Response" option to "yes", Response Page Path to "/index.html" and HTTP Response Code to "200". You can find that option inside your distribution and the error pages tab if you are using the console.