craftcms / element-api

Create a JSON API/Feed for your elements in Craft.
MIT License
498 stars 57 forks source link

Element API endpoint url for multisites? #192

Open aaronrobb opened 4 months ago

aaronrobb commented 4 months ago

Description

I have a site with multiple "multisite" sites. When using the Element-api endpoint it only creates it for the base url. So if we have example.com and sub.example.com, element-api endpoint only gets created for example.com. The issue is that we have cross-domain policy that won't let the basic example.com urls load on the sub.example.com.

Is there a way to set the endpoint to create/use the currentSite url?

Steps to reproduce

  1. Create endpoints via the element-api.php file
  2. Load sub-domain site and get errors about cross domain loading.

Additional info