CORS Header not present in default installations?

Hi there,

i want to write an import plugin for a CMS (kirbycms) which will import item information from an omeka s Site.

when i was using javascript fetch() inside my kirby-cms backend-module i realised that the omeka s installation does not provide a CORS Header by default, so i cannot pull data from the api due to
CORS-Kopfzeile 'Access-Control-Allow-Origin' fehlt (CORS HEADER missing)

Example and proof:

Explanation of Example and Proof:
I just used the first omeka s site that was mentioned at Omeka S - Directory
to validate my assumption.

Where, would you suggest do i put the header addition in the codebase of omeka-s?

i have seen that laminias comes with a HeaderLibrary but am lost a bit,

thank you kindly,
kind regards,

Edit: for now i am including the header info in the index.php which works, but feels a bit wrong :wink:

Probably the most natural place to add a header like that would be the ApiJsonStrategy that handles headers for the API’s JSON responses: see here.

1 Like