mirror of
				https://github.com/community-scripts/ProxmoxVE.git
				synced 2025-11-04 10:22:50 +00:00 
			
		
		
		
	Refactor Caddyfile configuration for headscale-admin (#7821)
This commit is contained in:
		@@ -53,3 +53,5 @@ description
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
msg_ok "Completed Successfully!\n"
 | 
					msg_ok "Completed Successfully!\n"
 | 
				
			||||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
 | 
					echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
 | 
				
			||||||
 | 
					echo -e "${INFO}${YW} Access it using the following URL:${CL}"
 | 
				
			||||||
 | 
					echo -e "${TAB}${GATEWAY}${BGN}Headscale API: ${IP}/api (no Frontend) | headscale-admin: http://${IP}/admin/${CL}"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,26 +24,24 @@ if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
 | 
				
			|||||||
  $STD caddy stop
 | 
					  $STD caddy stop
 | 
				
			||||||
  rm /etc/caddy/Caddyfile
 | 
					  rm /etc/caddy/Caddyfile
 | 
				
			||||||
  cat <<'EOF' >/etc/caddy/Caddyfile
 | 
					  cat <<'EOF' >/etc/caddy/Caddyfile
 | 
				
			||||||
:{$PORT:80}
 | 
					:80
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					redir /admin /admin/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
handle_path /admin* {
 | 
					handle_path /admin* {
 | 
				
			||||||
        root * /opt/headscale-admin
 | 
					    root * /opt/headscale-admin
 | 
				
			||||||
        encode gzip zstd
 | 
					    encode gzip zstd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Correct MIME types for JS/WASM
 | 
					    header {
 | 
				
			||||||
        header {
 | 
					        X-Content-Type-Options nosniff
 | 
				
			||||||
                @js_files path *.js
 | 
					    }
 | 
				
			||||||
                @wasm_files path *.wasm
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                Content-Type @js_files application/javascript
 | 
					    try_files {path} {path}/ /opt/headscale-admin/index.html
 | 
				
			||||||
                Content-Type @wasm_files application/wasm
 | 
					    file_server
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                X-Content-Type-Options nosniff
 | 
					handle /api/* {
 | 
				
			||||||
        }
 | 
					    reverse_proxy localhost:8080
 | 
				
			||||||
 | 
					 | 
				
			||||||
        # Fallback for SPA routing
 | 
					 | 
				
			||||||
        try_files {path} {path}/ index.html
 | 
					 | 
				
			||||||
        file_server
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user