Reputation: 514
I have a very peculiar problem.
Is there a restriction on CORS and the number of controllers in a single Lambda function for the .NET core?
Edit 1 : Adding code segments for better illustration
In ConfigureServices
var origins = Configuration.GetSection("AllowedCORS").AsEnumerable().Select(x => x.Value);
services.AddCors(o => o.AddPolicy("AllOrigins", builder =>
{
builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader();
}));
Then in Configure
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseCors("AllOrigins");
app.UseAuthentication();
app.UseMvc();
}
Upvotes: 1
Views: 439
Reputation: 514
I managed to resolve the issue by manually adding an Options handler in the controller and returning 200 OK.
Lambda does allow users to enable CORS but for some reason that method did not work for me (too many errors during setup)
At present i am restricting one Lambda function to one controller thereby giving me the freedom to modify only a certain set of the APIs.
Upvotes: 1