Now this seems pretty complicated. I've found a link to github that mentions your issue and I'm not sure if you looked at it.
https://github.com/janeczku/calibre-web/issues/1627
If you didn't, try it out. They should help you out there for sure. If not, then maybe someone else here will know how to deal with this issue.