Question regarding CORS:
I used light-codegen with a swagger api. Now I want to enable CORS on my microservice.
To accomplish this, I did the following:
- added a cors.yml in the config folder (same location as swagger.json, service.yml, server.yml ...)
- added dependency to pom.xml: groupId: com.networknt artifactId: cors
- added the following line to service.yml, right under swaggerHandler: - com.networknt.cors.CorsHttpHandler
but the server does not add any cors header to the response. What did I do wrong?
It looks like you are following an older version of the tutorial and trying to upgrade to the latest version of light-4j framework. The configuration files have been changed a lot and that might contribute the complexity.
I have upgraded and published CORS tutorial and there a link to the working version on github. Let me know if you encounter any issue. Thanks.
https://doc.networknt.com/tutorial/cors/