API based charts must have an endpoint that starts with "/forest/" !?

This is a weird behavior and there is a chance it’s my setup, but then again, there might be a chance it’s a bug.

I noticed that after upgrading to the latest forest-express-mongoose, my API-based dashboard charts broke when running locally. To fix them I changed my router settings to serve these charts under a URL path that starts with “/forest”.

It’s weird, I know, it might be my setup but maybe this is worth checking.

Expected behavior

I expected to be able to define any arbitrary API endpoint running on my backend to serve an API-based chart.

Actual behavior

This actually doesn’t work and produces this error:

Access to fetch at ‘http://localhost:3000/api/forest/users/total/canceled’ from origin ‘https://app.forestadmin.com’ has been blocked by CORS policy: The value of the ‘Access-Control-Allow-Origin’ header in the response must not be the wildcard ‘*’ when the request’s credentials mode is ‘include’.

I was able to fix it by moving all my API-based chart endpoints under “/forest/custom”. Also my custom actions were broken I was able to fix them in a similar way.


Please provide any relevant information about your setup.

  • forest-express: 9.2.5
  • forest-express-mongoose: 8.3.8
  • Express: 4.17.1
  • Mongoose Version: 5.4.10

Hello @cto_nexus,

Thank you for your feedback, I’ll share it with the team as this could be a needed change, in the code or in the documentation.

Glad you could fix this on your end, and sorry for the burden.

By any chance, can you remember if you changed anything related to CORS in your configuration around the time you upgraded forest-express-mongoose?

If not, can you share your current configuration with us so we can try to reproduce the issue?

Thank you

Note the app.use('/forest') and app.use('/forest/custom') routes.

It used to be app.use('/api/forest') and it failed. Seems like an unwritten rule somewhere. I will note I have a unique setup where both my production API and forest live in the same express app repo.

@anon79585656 Hi, were you ever able to find out if the API endpoints powering the routes have to start with “/forest” ? Are there any CORS/HTTP restrictions/requirements around these API-based charts?