Am running Hugo locally to test a page that fetches a remote json file on the local network. Console reports:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://192.168.178.30/data.json?heater=1. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
Searched the web, but cannot find a solution. Is it Hugo’s server config or should I look elsewhere?
Yes, read about CORS and the right headers on the server end. But how can I set these headers on hugo’s end? There’s no php setting of course and .htaccess isn’t applicable. For testing purposes as what is the intend of hugo server, it makes not much sense not to include the allowance for CORS?
What I lack in answers you make up with the quantity of your questions! Unfortunately, I’m having a difficult time reproducing the error. Please refer to Requesting Help and provide a repo that reproduces the error.
Asked two questions indeed. REsearching I found a workaround by using jsonp. Here is more info.