bblfsh / web

Web client for Babelfish server
http://dashboard.bblf.sh
GNU General Public License v3.0
23 stars 21 forks source link

Uses relative paths for urls and use # for gists in url #185

Closed se7entyse7en closed 5 years ago

se7entyse7en commented 5 years ago

Closes #177 as it makes bblfsh/web work both directly and behind a proxy with path other than /.

se7entyse7en commented 5 years ago

I haven't tested this by running bblfsh/web behind a Kubernetes proxy as written in issue #177, but for simplicity I've used nginx (I suppose that it should be the same) with the following configuration:

server {
    listen       8081;
    server_name  localhost;

    location /bblfsh/ {
        proxy_pass http://127.0.0.1:8080/;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
    }
}

where bblfsh/web was running on port 8080.

With this setup bblfsh/web works correctly both by using it directly through localhost:8080 and by using it behind nginx through localhost:8081/bblfsh.

smacker commented 5 years ago

@smola this PR doesn't change the way how SERVER_URL works. bblfsh/web is different from other our project where we set SERVER_URL dynamically. Here we use it during build step. But this change of the default allowed relative urls to work.