Using data in other secure websites (CORS issues)

This post was flagged by the community and is temporarily hidden.

Hi Woody,

I will investigate whether enabling CORS requests is feasible. In the meantime, you should be able to automate the data you need using the CKAN API. See: https://data.nsw.gov.au/data/api/1/util/snippet/api_info.html?resource_id=2f1ba0f3-8c21-4a86-acaf-444be4401a6d

Hi @Lance,

You might find these instructions to enable CORS useful.

It would be great to be able to pull data directly from within a webpage.

Hi @s2156945, since the data is not of a sensitive nature, you may consider sending it via a public proxy like https://cors-anywhere.herokuapp.com/https://data.nsw.gov.au/data/datastore/dump/21304414-1ff1-4243-a5d2-f52778048b29?format=json . Generally, public proxies are slow so you may be better off proxying it yourself through your backend, if you have a backend. Good luck!

Hi @Lance, I believe you are running CKAN 2.8.2, so these settings may be most useful: https://docs.ckan.org/en/2.8/maintaining/configuration.html#cors-settings

Thanks @jayen, your info is just what I needed - I have changed
my code to fall through.

  1. try and get the data direct (would work if the user’s browser
    (or settings) didn’t enforce cors or when the headers are added to
    data.nsw.gov.au)

  2. try and get the data via this proxy (works so far)

  3. just used the attached json file (was working before step 2
    was inserted)

And this is working. It only needs to download once per browser
which shouldn’t be a huge load on the proxy.

cheers,

Woody

© Data.NSW