Announcement

Collapse
No announcement yet.

Trouble enabling CORS Middleware

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trouble enabling CORS Middleware

    Good Day,

    I am trying to access EspoCRM Api from another domain. Locally this is both on localhost but the requesting app runs port 5173, EspoCRM on 8082. See first screenshot attached.

    CORS Middleware has been added recently (https://github.com/espocrm/espocrm/pull/2754) but when I add the supplied config to /data/config.php and clear the cache nothing changes in the API request.
    I expect the headers Access-Control-Allow-Origin and Access-Control-Allow-Methods​ to be present.

    Accessing the api directly in the browser works.

    What am I doing wrong?

  • #2
    Hello,

    I think you must add these in config-internal.php

    Comment


  • #3
    May be https://developer.mozilla.org/en-US/...l-Allow-Origin
    Attached Files

    Comment


    • fabianhirter
      fabianhirter commented
      Editing a comment
      This is a good point, but does not seem to be an issue here. I was able to get it running by setting the headers with the apache server, even with credentials. This probably is because the api uses "x-api-token" header instead of the "authorization" header thus the browser cannot know that this is a request with credentials.
Working...
X