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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用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 配置分析工具