Skip to content

Commit

Permalink
fix(client): fix Safety first
Browse files Browse the repository at this point in the history
  • Loading branch information
muink committed Dec 27, 2023
1 parent bbadb7b commit 3fbb48c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion root/etc/init.d/homeproxy
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ start_service() {
config_get_bool nginx_support "experimental" "nginx_support" "0"
if [ "$clash_api_enabled" = "1" -a "$nginx_support" = "1" ]; then
config_get clash_api_port "experimental" "clash_api_port" "9090"
[ "$(sed -En "s|^\s*proxy_pass\s+https?://[^:]+:(\d+).*|\1|p" "$APILOCATION_PATH")" = "$clash_api_port" ] || sed -Ei "/proxy_pass/{s|(\bproxy_pass\b)(\s+.+)?|\1 http://localhost:$clash_api_port/;|}" "$APILOCATION_PATH"
[ "$(sed -En "s|^\s*proxy_pass\s+https?://[^:]+:(\d+).*|\1|p" "$APILOCATION_PATH")" = "$clash_api_port" ] || sed -Ei "/\bproxy_pass\b/{s|(proxy_pass\s+https?://[^:]+:)(\d+)(.*)|\1$clash_api_port\3|}" "$APILOCATION_PATH"
/etc/init.d/nginx reload
fi

Expand Down
5 changes: 3 additions & 2 deletions root/etc/nginx/conf.d/homeproxy.locations
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ location /homeproxy/ {
proxy_pass http://localhost:9090/;
proxy_redirect default;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Connection "keep-alive";
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
add_header Cache-Control no-cache;
}

0 comments on commit 3fbb48c

Please sign in to comment.