Skip to content

Commit 25e89f7

Browse files
authored
Refactor Caddyfile configuration for headscale-admin (#7821)
1 parent 2686753 commit 25e89f7

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

ct/headscale.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,5 @@ description
5353

5454
msg_ok "Completed Successfully!\n"
5555
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
56+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
57+
echo -e "${TAB}${GATEWAY}${BGN}Headscale API: ${IP}/api (no Frontend) | headscale-admin: http://${IP}/admin/${CL}"

install/headscale-install.sh

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,24 @@ if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
2424
$STD caddy stop
2525
rm /etc/caddy/Caddyfile
2626
cat <<'EOF' >/etc/caddy/Caddyfile
27-
:{$PORT:80}
27+
:80
2828
29-
handle_path /admin* {
30-
root * /opt/headscale-admin
31-
encode gzip zstd
29+
redir /admin /admin/
3230
33-
# Correct MIME types for JS/WASM
34-
header {
35-
@js_files path *.js
36-
@wasm_files path *.wasm
31+
handle_path /admin* {
32+
root * /opt/headscale-admin
33+
encode gzip zstd
3734
38-
Content-Type @js_files application/javascript
39-
Content-Type @wasm_files application/wasm
35+
header {
36+
X-Content-Type-Options nosniff
37+
}
4038
41-
X-Content-Type-Options nosniff
42-
}
39+
try_files {path} {path}/ /opt/headscale-admin/index.html
40+
file_server
41+
}
4342
44-
# Fallback for SPA routing
45-
try_files {path} {path}/ index.html
46-
file_server
43+
handle /api/* {
44+
reverse_proxy localhost:8080
4745
}
4846
4947
EOF

0 commit comments

Comments
 (0)