Running grafana in a sub folder on apache

This is my docker setup

  grafana:
    image: grafana/grafana
    ports:
      - "3000:3000"
    volumes:
      - grafana-storage:/var/lib/grafana
      - ./certs/server.key:/etc/grafana/grafana.key
      - ./certs/server.crt:/etc/grafana/grafana.crt
    environment:
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=*****;
      - GF_SERVER_PROTOCOL=https
      - GF_SERVER_CERT_FILE=/etc/grafana/grafana.crt
      - GF_SERVER_CERT_KEY=/etc/grafana/grafana.key
      - GF_SERVER_DOMAIN=analytics.huntedcow.com/grafana/
    networks:
      - hcas

now unsure if i’m just reading the docs wrong but it looks like i only need to set the server domain?

In my apache config i have a reverse proxy for /grafana/

<VirtualHost *:443>
    DocumentRoot /app
    SSLEngine on
    SSLProxyEngine on
    SSLCertificateFile /ssl/cert.crt
    SSLCertificateKeyFile /ssl/cert.key
    <Directory /app>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

     # Route requests starting with /grafana to Grafana
     ProxyPass /grafana/ https://grafana:3000
     ProxyPassReverse /grafana/ https://grafana:3000
    ProxyPreserveHost On
</VirtualHost>

however when i visit my site on /grafana it changes the url to /grafana/:3000/ and then the web server doesn’t know what /grafana/:3000/ is

i’m trying to run grafana in a sub folder because my main site has a php app that handles an api and a dashboard system

i also have a .htaccess on my main php app

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Route anything after /api/ to /api/index.php
    RewriteCond %{REQUEST_URI} !^/api/index\.php$ [NC]
    RewriteRule ^api/.*$ /api/index.php [L,QSA]

    # Handle other rewrites
    RewriteCond %{REQUEST_URI} !^/api/ [NC]
    RewriteCond %{REQUEST_URI} !^/grafana/.*$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php [L,QSA]
</IfModule>

however i do have a rule to not rewrite /grafana/ as i think this .htaccess was messing with the apache proxy?

Any help would be appreciate. Thanks.