Enable CORS in mGramSeva services
Overview
We can not access API's when API’s hosted domain is different from the UI domain. To resolve this issue we will enable cors in the service for a specific domain, e.g. we have two services that are hosted in mGramSeva and DIGIT-UI is hosted in iFix.
Configuration
For any service, cors is default false, for enabling the cors add the following configuration in the environment
{service-name}:
ingress:
cors:
enabled: true
annotations:
nginx.ingress.kubernetes.io/cors-allow-origin: {origin-url}
e.g. for mGramSeva QA added in deploy-as-code/helm/environments/mgramseva-qa.yaml
adapter-master-data-service:
ingress:
cors:
enabled: true
annotations:
nginx.ingress.kubernetes.io/cors-allow-origin: "https://ifix-qa.ifix.org.in"
ifix-department-entity-service:
ingress:
cors:
enabled: true
annotations:
nginx.ingress.kubernetes.io/cors-allow-origin: "https://ifix-qa.ifix.org.in"
Note - After adding the configuration deploy the service again.