How to set ROOT_URL to support both http/https by Nginx?

gitea configured for http only.
when I set ROOT_URL to ‘http://xxx.com/’, I’ll get a warning if I visit it with “https://xxx.com”. and vice versa.

then set ROOT_URL as https://xxx.com