+1
Not a bug

cross-origin error in angular

roizofiof 5 years ago updated by Michael J. Radwin 1 year ago 3

Hi,

I'm trying to convert georgian date to hebrew date via your api but I get this error:

Access to XMLHttpRequest at 'https://www.hebcal.com/converter/?cfg=json&gy=2000&gm=12&gd=31&g2h=1' from origin 'http://localhost:4200' has been blocked by CORS policy: Request header field Access-Control-Allow-Origin is not allowed by Access-Control-Allow-Headers in preflight response.

I am using angular observable.

What I need to do?

Not a bug

Glad you got it working!

Our API tries to be very open when it comes to CORS. We always include Access-Control-Allow-Origin: * in the response when the cfg parameter is set to json.


No authentication or authorization is required to use our API. It is accessible to a wide range of users without restrictions.

    I tried it with fetch rather than axios and it worked

    I am trying to use the Jewish calendar REST API in a React app

    https://www.hebcal.com/hebcal/?v=1&cfg=json&yt=H&D=off&maj=on&min=off&mod=off&nx=on&start=2022-08-01&end=2023-01-14&month=x&ss=on&mf=off&c=off&geo=zip&zip=02135&M=on&s=on&lg=a&leyning=off

    However, I get this error:

    Request header field x-csrf-token is not allowed by Access-Control-Allow-Headers in preflight response.