AJS.params.baseURL returning wrong base URL ( HTTP instead of HTTPS )

I am using JIRA v9.11.3

The application is running in K8s behind reverse proxy.

When I access https://[MyDomain]/jira/secure/InsightReportManager.jspa
The page tries to access
http://[MyDomain]/jira/rest/insight-widgets/1/user/configuration

Because it is getting the BaseUrl from riada.api.baseURL which in-turn get the base URL from AJS.params.baseURL

I have already configured my Jira base URL to HTTPS and all other pages works fine. What went wrong? Thank you a lot!