I implementing ocelot in my new project, i create the integration of my services in one point with ocelot but when i try to post, put, path or delete to a resource in my api gateway, the browser show me the message
Failed to load http://localhost:8080/api/prospects: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8888' is therefore not allowed access. The response had HTTP status code 404.
I try to configure cors in gateway installing and implementing the package Microsoft.AspNetCore.Cors
public void ConfigureServices(IServiceCollection services)
{
services.AddCors();
services.AddOcelot(Configuration)
.AddCacheManager(x =>
{
x.WithMicrosoftLogging(log =>
{
log.AddConsole(Microsoft.Extensions.Logging.LogLevel.Debug);
})
.WithDictionaryHandle();
}); ;
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
app.UseCors(
options => options.WithOrigins("http://localhost:8888").AllowAnyMethod()
);
app.UseOcelot().Wait();
}