metabase / metabase

The simplest, fastest way to get business intelligence and analytics to everyone in your company :yum:
https://metabase.com
Other
38.82k stars 5.16k forks source link

Allow Metabase to work on sub paths #30895

Open paoliniluis opened 1 year ago

paoliniluis commented 1 year ago

Is your feature request related to a problem? Please describe. Right now Metabase expects to be running in the root path of the server and that brings us some problems when users set it up on a sub path. Right now it acts really weird if you just expose the server in a sub path without doing any kind of redirection.

Describe the solution you'd like We should parse the MB_SITE_URL and see if it's running on a sub-path to make it work correctly with this pattern

Describe alternatives you've considered An more-than-needed complicated nginx config

How important is this feature to you? Important for customers that need to host Metabase in sub-paths

Additional context NA

ahnaf-tahmid-chowdhury commented 1 year ago

I have configured Like this but getting blank page

metabase

MB_SITE_URL="/metabase/"

nginx

server {
    listen 443 ssl default_server;
    listen [::]:443 ssl default_server;
    ssl_certificate my crt;
    ssl_certificate_key my key;
    client_max_body_size 10M;
    server_name _;

    location / {
    here is my django server
    }

    location /metabase/ {
    proxy_pass http://localhost:3000;

    }
}
paoliniluis commented 1 year ago

It’s not a valid site url

ahnaf-tahmid-chowdhury commented 1 year ago

It’s not a valid site url

Hi @paoliniluis, thank you. I tried using the complete site URL, but it didn't work out.

MB_SITE_URL="https://nrms.mist.ac.bd/metabase/"

The site is now closed.

paoliniluis commented 1 year ago

Check the console, you might see the error there. Btw: you should post this on the forums

Shalashtein commented 12 months ago

I have the same issue, I looked through the forums and the questions around this issue are stale

ahnaf-tahmid-chowdhury commented 12 months ago

I have the same issue, I looked through the forums and the questions around this issue are stale

I am using nginx to fix this for now

    location /metabase/ {
        proxy_pass http://localhost:3000/; 
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;  
        proxy_set_header   Host $host;
        proxy_set_header   X-Forwarded-Host $host;
        proxy_redirect     ~^/(.*)$ /metabase/$1; 
    }
setop commented 6 months ago

does not work form me neither with last version v0.49.8 behind treafik.

a bit of a shame as it is a pretty common production setup.