dremio nginx proxy 问题简单说明二

以前说过基于修改dremio 服务的静态index.html 实际上还有一种方法就是直接通过nginx 的sub_filter 指令,以下是简单说明

配置

核心是nginx ,后端服务就不需要修改了

  • nginx.conf

核心是sub_filter 的匹配处理

worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    gzip  on;
    real_ip_header     X-Forwarded-For;
    real_ip_recursive on;
    server {
        listen       80;
        server_name  localhost;
        charset utf-8;
        root /usr/share/nginx/html;
        location = /vlake/ {
           sub_filter '</body>' '<script > history.pushState({}, "default", "/");</script></body>';
           sub_filter_types text/html; 
           sub_filter_once off;
           proxy_set_header Accept-Encoding '';
           proxy_pass http://dremio:9047/index.html;
        }
         location = /vlake/index.html {
          sub_filter '</body>' '<script > history.pushState({}, "default", "/");</script></body>';
           sub_filter_types text/html; 
           sub_filter_once off;
           proxy_set_header Accept-Encoding '';
            proxy_pass http://dremio:9047;
        }
        location @dremio {
            proxy_http_version 1.1;
            rewrite ^/vlake/(.*)$ /$1 break;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection upgrade;
            proxy_pass http://dremio:9047;
        }
        location /login {
            proxy_pass http://dremio:9047/index.html;
        }
        location  ^~ /static/ {
             proxy_pass http://dremio:9047;
        }
        location /manifest.webmanifest  {
            return 200;
        }
        location /apiv2/ {
            proxy_http_version 1.1;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection upgrade;
            proxy_pass http://dremio:9047/apiv2/;
        }
        location /api/v3/ {
            proxy_http_version 1.1;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection upgrade;
            proxy_pass http://dremio:9047/api/v3/;
        }
 
        location ^~ /jobs/ {
            proxy_pass http://dremio:9047/index.html;
        }
 
        # location ^~ /vlake/new_query/ {
        #     rewrite ^/(.*)/$ /vlake/$1/index.html break;
        #     proxy_pass http://dremio:9047;
        # }
 
        # location ^~ /new_query/ {
        #     rewrite ^/(.*)/$ /vlake/$1/index.html break;
        #     proxy_pass http://dremio:9047;
        # }
        location ^~ /vs/ {
            proxy_pass http://dremio:9047/vs/;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

说明

以上是一个简单说明,处理上基于nginx 的sub_filter 处理简单快速,配置我已经push github 了可以参考

参考资料

https://github.com/rongfengliang/nginx-dremio-proxy/tree/dev
https://nginx.org/en/docs/http/ngx_http_sub_module.html

posted on   荣锋亮  阅读(8)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2022-05-26 dremio 的 joust 的作用
2022-05-26 dremio 21.1 分布式存储单机测试的一种方法
2018-05-26 nexus && minio s3 存储私有镜像
2017-05-26 java 二维码生成(vcard)
2017-05-26 Gixy Nginx 配置分析工具

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示