Hi Team, how to allow CORS origin for glue API.

nagapavankumar.guggil
nagapavankumar.guggil Spryker Solution Partner Posts: 6 🧑🏻‍🚀 - Cadet

i had configured $config[GlueApplicationConstants::GLUE_APPLICATION_CORS_ALLOW_ORIGIN] = '*';

i can able to access on postman and endpoints on browser but when i was glue api endpoint i was getting the cors error

Comments

  • Hidran Arias
    Hidran Arias Senior Technical Trainer Sprykee Posts: 81 🏛 - Council (mod)

    Could you please share a screenshot where we can see the endpoint and the parameters you're passing?

    Show also the headers tab.

  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,051 ⚖️ - Guardians (admin)

    Heyhey @nagapavankumar.guggil ,

    your change should have worked in theory so please provide some more infos as Hidran suggested :)

    Additional I want to add that it would be better practise to leave that config line defined by environment variable

    $config[GlueApplicationConstants::GLUE_APPLICATION_CORS_ALLOW_ORIGIN] = getenv('SPRYKER_GLUE_APPLICATION_CORS_ALLOW_ORIGIN') ?: '';

    And adjust the deploy-files similar to that:

    glue_eu:
    application: glue
    endpoints:
    glue.de.spryker.local:
    store: DE
    cors-allow-origin: '*'
    glue.at.spryker.local:
    store: AT

    With this it is easier to configure it later in the cloud.

    All the best,

    Florian

  • nagapavankumar.guggil
    nagapavankumar.guggil Spryker Solution Partner Posts: 6 🧑🏻‍🚀 - Cadet