Open Closed

CORS Policy not applying on specific app services using EnableCors attribute #5904


0
muradkayani created

I want only a few app services to be exposed as public APIs without specifying origin of the site in appsettings.json All other app service should work only for allowd origins in appsettings.json

For this i have defined cors policy as folloing

2018-11-07 18_15_37-Window.png

Fnd using EnableCors Attribute on app service

[EnableCors("AllowAll")] public class GuideReaderAppService : GuideBuddyAppServiceBase, IGuideReaderAppService { ...

while searching support forum i have read a few question but no help for example this one


4 Answer(s)
  • 0
    ismcagdas created

    Hi @muradkayani

    Does it work if you use [EnableCors("AllowAll")] for a regular ASP.NET Core Controller ?

  • 0
    ismcagdas created

    @muradkayani any news ?

  • 0
    muradkayani created

    Hi, i was busy in some other priority items.

    Anyhow while it did not work for a simple controller as well and i think this is the reason behind.

    it appears that we are mixing two different approaches for enabeling CORS which is not recommended as stated in the above link.

  • 0
    muradkayani created

    while i disbale middleware it caused some framework enpoints to stop working so as a workaround i did this for now but its not a clean approch, but its working fine. image.png