Posts

Showing posts with the label cors

Mapped color transformation on cors tainted image

Image
Clash Royale CLAN TAG #URR8PPP Mapped color transformation on cors tainted image I need to transform colors in an image obtained from an s3 server which disallows crossOrigin. This is the functionality I need: const img = new Image(); img.src = src; ctx.drawImage(img, 0, 0); const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); const colors = [25,50,100,255]; const data = imageData.data; for (let i = 0; i < data.length; i += 4) { if(data[i] == 1){data[i] = colors[1]} if(data[i] == 2){data[i] = colors[2]} if(data[i] == 3){data[i] = colors[3]} } but got tainted by crossOrigin error: I know I can not use getImageData in this case. I don't want to read the image data. getImageData But maybe complete my task through some other webGL / canvas operation? Rendering on a server or proxying is not possible. Possible duplicate of How to fix getImageData() error The canvas has been tainted by cross-origin data? ...

AWS Lambda how do I properly allow CORs?

Image
Clash Royale CLAN TAG #URR8PPP AWS Lambda how do I properly allow CORs? I know this question gets asked a lot and I have looked through other questions/answers but I still can't get it to work. I have read and followed: https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-cors.html This is my lambda function: let http = require('https') exports.handler = (event, context, callback) => { const STORE_HASH = '1234' const PATH = `/stores/${STORE_HASH}/v3/catalog/products?limit=100` const AUTH_TOKEN = '1234' const AUTH_CLIENT = '1324' let options = { "method": "GET", "hostname": "api.bigcommerce.com", "port": null, "path": PATH, "headers": { "x-auth-client": AUTH_CLIENT, "x-auth-token": AUTH_TOKEN, "content-type": "application/json", ...

Cross domain from browser to express server doesn't work

Image
Clash Royale CLAN TAG #URR8PPP Cross domain from browser to express server doesn't work I know this has been asked more than a hundred times... I did look into most of the information I found, and think I did understand the process, cause I was able to configure my s3 to allow cross domain access.. my express configuration: this.express = new Express(); this.express.all("*", (req, res, next) => { res.setHeader('Access-Control-Allow-Origin', "*"); res.setHeader('Access-Control-Allow-Methods', "POST"); res.setHeader('Access-Control-Allow-Headers', "content-type"); next(); }).options((req, res, next) => { res.end(); }); *I add a router down the modules folder hierarchy.. When I check the network tab this is what I see: I think that I have answered the CORS challenge, in the pre-flight OPTIONS request, but the second request is not called... WHY? ...