Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: CodeCC For 1.5 #4572 #4679

Merged
merged 1 commit into from
Jul 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions support-files/codecc/templates/codecc.frontend.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
root $static_dir_codecc;
index index.html index.htm;

# 设置默认的ico
location = /favicon.ico {
header_filter_by_lua_file 'conf/lua/cors_filter.lua';
root /;
rewrite .* conf/static/favicon.ico break;
}

location / {
header_filter_by_lua_file 'conf/lua/cors_filter.lua';
add_header Cache-Control no-store;
index index.html index.htm;
try_files $uri @fallback;
}

location ~* \.(html)$ {
header_filter_by_lua_file 'conf/lua/cors_filter.lua';
add_header Cache-Control no-store;
try_files $uri @fallback;
# 匹配所有以 html结尾的请求
}

location ~* \.(js|css|ttf)$ {
header_filter_by_lua_file 'conf/lua/cors_filter.lua';
add_header Cache-Control max-age=2592000;
try_files $uri @fallback;
# 匹配所有以 js,css或tff 结尾的请求
}

location @fallback {
header_filter_by_lua_file 'conf/lua/cors_filter.lua';
add_header Cache-Control no-store;
rewrite .* /index.html break;
}

# resource资源接口
location ~ ^/(ms/|)([\w-_]+)/resource/(.*) {
header_filter_by_lua_file 'conf/lua/cors_filter.lua';
set $service $2;
set $path $3;
set $target '';
access_by_lua_file 'conf/lua/router_srv.lua';

# 设置proxy header的变量
include proxy.set.header.common.conf;

# 反向代理到目标ip,端口,路径和参数
proxy_pass http://$target/resource/$path?$args;
}