Fixing React-Admin fetch of the CORS X-Total-count Header
Een reactie plaatsennovember 17, 2022 door Tim
React-Admin is a great tool for creating admin interfaces, but one issue you may run into is fetching the X-Total-count Header when using CORS. This can be fixed by setting the “Access-Control-Expose-Headers” header in your server’s response.

Example Asp.net, program.cs
app.UseCors(builder => builder
.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
.WithExposedHeaders("X-Total-Count")
);