My API application is configured to allow cross domain requests by setting:
services.AddCors(
options =>
{
options.AddDefaultPolicy(
builder =>
{
builder.WithOrigins("http://localhost:4200")
.AllowAnyMethod()
.AllowAnyHeader();
});
});
and
app.UseForwardedHeaders(forwardedHeadersOptions)
.UseRouting()
.UseCors()
When a request to any of my APIs contains the Origin request header with a value of http://localhost:4200 the http response header access-control-allow-origin is set to http://localhost:4200. CORS configuration is working.
When a request is made to the swagger.json endpoint rendered by Swashbuckle, and the Origin request header is included as mentioned previously, no access-control-allow-origin header is included in the response.
I am unable to locate any documentation that mentions separate configuration required for Swashbuckle to handle CORS requests.
My API application is configured to allow cross domain requests by setting:
and
When a request to any of my APIs contains the
Originrequest header with a value ofhttp://localhost:4200the http response headeraccess-control-allow-originis set tohttp://localhost:4200. CORS configuration is working.When a request is made to the swagger.json endpoint rendered by Swashbuckle, and the Origin request header is included as mentioned previously, no
access-control-allow-originheader is included in the response.I am unable to locate any documentation that mentions separate configuration required for Swashbuckle to handle CORS requests.