Enable basic auth on prometheus

I am using PMM server 2.2.0 in docker. I want to enable the basic auth on prometheus so I do it from the Web UI:

  1. Configuration → Data Sources → Prometheus
  2. Enable “Basic auth”
  3. Enter “User” and “Password” in “Basic Auth Details” section
  4. Save and restart the PMM server
    Then I try run "curl ‘http://x.x.x.x:9090/prometheus/api/v1/query?’ --data-urlencode ‘query=’. It runs successfully without any authentictioin. The basic auth seems not working in this way.

Then I follow the method of setting basic auth of nginx on prometheus ([URL]https://prometheus.io/docs/guides/basic-auth/[/URL]). I edit the /etc/supervisord.d/prometheus.ini in the container to add the line
–web.route-prefix=“/” and restart the PMM server. But the new added line is revoked after restart.

I would like to know the proper way to add basic auth on the prometheus.
Thanks for any help.