The gauge invariance problem of the Maxwell field in the presence of
torsion has been known for many years. There is no known perfect solution
for this problem.

The importance of having the gauge invariance of the Maxwell action is that it implies charge conservation which is very well established experimentally.

One type of suggestions (please see Sabbata )
is through nonminimal coupling of the maxwell field to torsion. There are
other suggestions restricting the types of connections.

However, the "solution" by Benn Dereli and Tucker Phys Lett. B. 96B 100-104 (1980) reviewed is a recent paper by Socolovsky(section 35) seems more appealing as it does not involve any change in the geometric structure of the Maxwell theory coupled to an Einstein-Cartan background,
nor waives the minimal coupling. Here the Maxwell field is defined to be
the exterior derivative of the vector potential (as in Pavel's answer),
and the Maxwell action has its "flat space" form except for the curved
space-time measure, which is manifestly gauge invariant. However, the independent variables are taken to be the tetrad components of the gauge potential $A_a =e_a^{\mu} A_{\mu}$ rather the space-time components. In this solution, the gauge noninvariance is manifested
in the solution of the field equations for the torsion itself being proportional to the field's non gauge invariant spin density tensor. However, the Lorentz generators
being the space integrals of the spin density zero components are still gauge
invariant.

This post has been migrated from (A51.SE)