Multiple servers generating error 500 in HANGFIRE Multiple servers generating error 500 in HANGFIRE kubernetes kubernetes

Multiple servers generating error 500 in HANGFIRE


You can now add IgnoreAntiforgeryToken to your service which should resolve this issue.

According to this github post, the issue occured when you had multiple servers running the dashboard and due to load balancing when your request went to different server from the one you originally got the page, you'd see the error.

Adding IgnoreAntiforgeryToken = true to the dashboard should resolve the issue.

Excerpt Taken from here

app.UseHangfireDashboard("/hangfire", new DashboardOptions{    Authorization = new[] {new HangfireAuthFilter()},     IgnoreAntiforgeryToken = true                                 // <--This});


We solved this issue by persisting our DataProtectionKeys in Redis for all replicas to read from.

services.AddDataProtection().PersistKeysToStackExchangeRedis(redis, $yourprefix::DataProtectionKeys");