Roland Ringgenberg
04/11/2025, 12:55 PMCLOVIS
04/11/2025, 1:02 PMtheapache64
04/11/2025, 1:10 PMAccess-Control-Allow-Origin
with your domain name. One method to bypass this is to run a reverse proxy in your server to collect data from openlibrary api
theapache64
04/11/2025, 1:12 PMRoland Ringgenberg
04/11/2025, 2:54 PMCLOVIS
04/11/2025, 3:08 PMJust klick on it and you will see that it works perfectly from whatever browser or app. No need for a proxy.That's because it's a direct request from the same-origin. You (the user) wants to access that page. CORS (cross-origin resource sharing) doesn't come into play. Now if you host a website under your own domain name, and that website tries to access that page, then it's a cross-origin request and CORS gets triggered.
CLOVIS
04/11/2025, 3:10 PMRoland Ringgenberg
04/11/2025, 3:47 PMRoland Ringgenberg
04/11/2025, 4:21 PMdefaultRequest {
contentType(ContentType.Application.Json)
}
The CORS preflight error was telling already what the problem was: '... has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.'
By setting the the content type for each request the CORS preflight request failed. Cool, thx for your help!CLOVIS
04/11/2025, 4:35 PM