Use fakehttpContext in Autofac container used by hangfire

One of my applications works as follows:

For every post to asp.net mvc action, application calls a Background job. I have configured the autofac container and provided it to hangfire in startup code.

One of the configuration in autofac intialization works like this:

builder.Register(c =>
httpContext.Current …

)().As().InstancePerLifeTimeScop();

So the autofac resolves the interface ‘IXmlResolver’ based on some logic that depend on HttpContext.

Obviously when the autofac resolution is called in the context of Background job, the above does not work becuase httpContext.current is null. I would like a way to pass job dependent data to autofac, so that the interface is resolved properly. Please help!