nginx.conf 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. events { }
  2. http {
  3. server {
  4. listen 10090;
  5. location / {
  6. # Removes any Access-Control-Allow-Origin from Prometheus itself. When accessing from browser, having * or
  7. # multiple values is not allowed in some cases
  8. proxy_hide_header Access-Control-Allow-Origin;
  9. # Allow the origin access. This is kinda wildcard but for browser it seems more strict and is needed for
  10. # withCredentials requests.
  11. add_header Access-Control-Allow-Origin $http_origin;
  12. # When using withCredentials requests this must be true.
  13. add_header Access-Control-Allow-Credentials true;
  14. # Ask for basic auth except for pre flight OPTIONS request.
  15. limit_except OPTIONS {
  16. ################################################################
  17. # The htpasswd file contains user:
  18. # prom: test
  19. ################################################################
  20. auth_basic "prom";
  21. auth_basic_user_file /etc/nginx/htpasswd;
  22. }
  23. proxy_pass http://prometheus:9090/;
  24. }
  25. }
  26. }