CORS errors
jlvdh opened this issue · comments
I'm using the following setup:
imaginary:
image: h2non/imaginary:latest
environment:
PORT: 9000
DEBUG: "*"
command: -cors -enable-url-source -enable-auth-forwarding -allowed-origins <image-service>
ports:
- "9001:9000"
And when I'm fetching the image in my code:
await fetch(src, {
method: 'GET',
headers: {
Authorization: Bearer <token>
},
})
But I'm still getting a cors error.
has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Setup works using postman. Any help would be greatly appreciated :)
I'm having the same issue, it works with CURL but in the browser it fails.
I've got a Dockerfile setup like so:
FROM h2non/imaginary:latest
ENV DEBUG *
# @TODO: Add origins here via terraform or something
CMD ["-cors", "-allowed-origins", "http://localhost:3000"]
EXPOSE 9000
I get the CORS header ‘Access-Control-Allow-Origin’ missing
error in my console, and according to firefox it only returns
HTTP/1.1 405 Method Not Allowed
Content-Type: application/json
Date: Mon, 22 Mar 2021 23:22:42 GMT
Content-Length: 123
with no body. This is in response to the OPTIONS preflight request.
HI @Redmega, we finally got it running with these changes: jlvdh/sd-imaginary@d377948