# πŸš€ URL Redirect Tracker - Comprehensive Documentation **Author:** Based on code review **Date:** Generated from current codebase analysis **Purpose:** Complete overview of current features, data flows, and user workflows --- ## πŸ“‹ Table of Contents 1. [Application Overview](#application-overview) 2. [Current Features](#current-features) 3. [Architecture](#architecture) 4. [Data Structures](#data-structures) 5. [User Workflows](#user-workflows) 6. [API Endpoints](#api-endpoints) 7. [Frontend Components](#frontend-components) 8. [Security Features](#security-features) 9. [Technical Implementation](#technical-implementation) --- ## 🎯 Application Overview The URL Redirect Tracker is a full-stack web application that analyzes and visualizes HTTP redirect chains. It helps users understand where their URLs ultimately lead, detect security issues, and analyze redirect performance. ### Core Purpose - Track complete redirect chains from initial URL to final destination - Analyze HTTP status codes, headers, and response metadata - Detect security issues (SSL downgrades, redirect loops) - Provide detailed performance metrics and timing information --- ## βœ… Current Features ### πŸ” Core Tracking Features - **Multi-method Support**: GET, HEAD, POST requests - **Custom User-Agent**: Predefined options (Googlebot, Chrome, iPhone Safari, etc.) - **SSL Certificate Analysis**: Detailed SSL/TLS information extraction - **Response Body Capture**: Truncated response content for analysis - **Timing Metrics**: Individual request duration tracking - **Error Handling**: Graceful handling of failed requests ### πŸ›‘οΈ Security & Analysis Features - **Redirect Loop Detection**: Identifies circular redirects - **SSL Downgrade Warning**: Detects HTTPS β†’ HTTP transitions - **Mixed Content Detection**: Security warnings for protocol downgrades - **Certificate Validation**: SSL certificate details and validity - **Tracking Parameter Analysis**: UTM, Facebook, Google click IDs extraction ### 🎨 User Interface Features - **Dark/Light Mode Toggle**: System preference detection with manual override - **Responsive Design**: Mobile-optimized interface - **Print-Friendly**: Optimized print layouts - **Collapsible Details**: Expandable sections for detailed information - **Copy to Clipboard**: Easy URL copying functionality - **Tabbed Content**: Organized information display (Headers, Body, Metadata, etc.) ### πŸ“Š Data Visualization - **Summary Statistics**: Redirect count, status code breakdown - **Step-by-Step Breakdown**: Detailed chain visualization - **Performance Metrics**: Response time analysis - **SSL/Non-SSL Indicators**: Visual security status ### πŸ”§ API Features - **Versioned API**: `/api/v1/track` with standardized responses - **Rate Limiting**: 100 requests per hour per IP - **Multiple Input Methods**: POST with JSON body, GET with query parameters - **Backward Compatibility**: Legacy `/api/track` endpoint maintained - **API Documentation**: Built-in documentation at `/api/docs` --- ## πŸ—οΈ Architecture ### System Architecture (ASCII Diagram) ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ CLIENT BROWSER β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ index.html β”‚ β”‚ script.js β”‚ β”‚ styles.css β”‚ β”‚ β”‚ β”‚ (UI Layout) β”‚ β”‚ (Logic/API) β”‚ β”‚ (Styling) β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ HTTP Requests β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ EXPRESS.JS SERVER β”‚ β”‚ (index.js) β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Rate Limiting β”‚ β”‚ API Routes β”‚ β”‚ Static Files β”‚ β”‚ β”‚ β”‚ Middleware β”‚ β”‚ Handler β”‚ β”‚ Serving β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ trackRedirects() β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ REDIRECT TRACKING ENGINE β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ HTTP Client β”‚ β”‚ SSL Analysis β”‚ β”‚ Response β”‚ β”‚ β”‚ β”‚ (Axios) β”‚ β”‚ (HTTPS Agent) β”‚ β”‚ Processing β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ HTTP Requests β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ TARGET WEBSITES β”‚ β”‚ (External URLs being tracked) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ### Application Flow (ASCII Diagram) ``` User Input β†’ Form Validation β†’ API Request β†’ Redirect Tracking β†’ Response Processing β†’ UI Update β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ User entersβ”‚ β”‚ Frontend β”‚ β”‚ Backend β”‚ β”‚ External β”‚ β”‚ URL │────▢│ validates & │────▢│ tracks │────▢│ websites β”‚ β”‚ β”‚ β”‚ sends API β”‚ β”‚ redirects β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β–Ό β–Ό β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ Loading β”‚ β”‚ Recursive β”‚ β”‚ β”‚ Indicator β”‚ β”‚ Function β”‚β—€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β–Ό β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Results │◀───│ Response β”‚ β”‚ Display β”‚ β”‚ Data β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` --- ## πŸ“Š Data Structures ### Redirect Object Structure ```javascript { url: "https://example.com", // Current URL timestamp: 1234567890123, // Request timestamp isSSL: true, // SSL status duration: 245, // Request duration (ms) statusCode: 301, // HTTP status code statusText: "Moved Permanently", // Status text final: false, // Is final destination error: null, // Error message if any metadata: { // Request/response metadata status: 301, statusText: "Moved Permanently", headers: { "location": "https://www.example.com", "content-type": "text/html", "server": "nginx/1.18.0", // ... other headers }, contentType: "text/html", contentLength: "178", server: "nginx/1.18.0", date: "Thu, 01 Jan 2024 12:00:00 GMT", protocol: "https:", method: "GET" }, responseBody: "...", // Truncated response body sslInfo: { // SSL certificate info valid: true, issuer: { /* certificate issuer */ }, subject: { /* certificate subject */ }, validFrom: "Jan 1 00:00:00 2024 GMT", validTo: "Jan 1 00:00:00 2025 GMT", fingerprint: "AA:BB:CC:DD:..." } } ``` ### API Response Structure (v1) ```javascript { success: true, status: 200, data: { url: "http://example.com", method: "GET", redirectCount: 2, finalUrl: "https://www.example.com/", finalStatusCode: 200, redirects: [ // Array of redirect objects (see above) ] } } ``` ### Tracking Parameters Structure ```javascript { "Source": "google", // utm_source "Medium": "cpc", // utm_medium "Campaign": "summer_sale", // utm_campaign "Google Click ID": "abc123def456", // gclid "Facebook Click ID": "xyz789uvw012" // fbclid // ... other detected parameters } ``` --- ## πŸ‘€ User Workflows ### Primary User Journey (ASCII Diagram) ``` START β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ User visits β”‚ β”‚ application β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Enter URL │────▢│ Select β”‚ β”‚ in input β”‚ β”‚ HTTP method β”‚ β”‚ field β”‚ β”‚ (GET/HEAD/ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ POST) β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β–Ό β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ Choose User β”‚β—€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ Agent (opt.) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Click Track β”‚ β”‚ Redirects β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Loading β”‚ β”‚ Backend β”‚ β”‚ indicator │────▢│ processes β”‚ β”‚ shown β”‚ β”‚ request β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β–Ό β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Results │◀───│ Redirect β”‚ β”‚ displayed β”‚ β”‚ chain β”‚ β”‚ β”‚ β”‚ tracked β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ User can: β”‚ β”‚ β€’ View detailsβ”‚ β”‚ β€’ Copy URLs β”‚ β”‚ β€’ Print β”‚ β”‚ β€’ Toggle mode β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό END ``` ### Error Handling Flow ``` Error Occurs β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Network β”‚ β”‚ Invalid β”‚ β”‚ Error β”‚ β”‚ URL β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β–Ό β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Display β”‚ β”‚ Form β”‚ β”‚ error β”‚ β”‚ validation β”‚ β”‚ message β”‚ β”‚ message β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β–Ό β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Allow retry β”‚ β”‚ Highlight β”‚ β”‚ with same β”‚ β”‚ input field β”‚ β”‚ parameters β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` --- ## πŸ”Œ API Endpoints ### Endpoint Overview | Method | Endpoint | Purpose | Rate Limited | |--------|----------|---------|--------------| | POST | `/api/track` | Legacy redirect tracking | No | | POST | `/api/v1/track` | Modern redirect tracking | Yes (100/hr) | | GET | `/api/v1/track` | URL tracking via query params | Yes (100/hr) | | GET | `/api/docs` | API documentation | No | | GET | `/` | Serve main application | No | ### Request/Response Flow (ASCII Diagram) ``` Client Request β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Rate Limit β”‚ β”‚ Check β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Input β”‚ β”‚ Validation β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ URL β”‚ β”‚ Normalization β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Redirect β”‚ β”‚ Tracking β”‚ β”‚ (Recursive) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Response β”‚ β”‚ Formatting β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό Client Response ``` --- ## 🎨 Frontend Components ### Component Structure ``` Frontend Application β”œβ”€β”€ HTML Structure (index.html) β”‚ β”œβ”€β”€ Header (Title + Dark mode toggle) β”‚ β”œβ”€β”€ Form (URL input + options) β”‚ β”œβ”€β”€ Loading indicator β”‚ β”œβ”€β”€ Error display β”‚ β”œβ”€β”€ Warnings display β”‚ └── Results section β”‚ β”œβ”€β”€ Summary β”‚ β”œβ”€β”€ Tab navigation (List/Graph) β”‚ └── Content areas β”‚ β”œβ”€β”€ JavaScript Logic (script.js) β”‚ β”œβ”€β”€ Form handling β”‚ β”œβ”€β”€ API communication β”‚ β”œβ”€β”€ Results processing β”‚ β”œβ”€β”€ UI state management β”‚ β”œβ”€β”€ Dark mode logic β”‚ β”œβ”€β”€ Copy to clipboard β”‚ β”œβ”€β”€ Tab switching β”‚ └── Error handling β”‚ └── CSS Styling (styles.css) β”œβ”€β”€ Layout & Grid β”œβ”€β”€ Dark/Light themes β”œβ”€β”€ Responsive design β”œβ”€β”€ Component styles └── Print styles ``` ### State Management Flow ``` Initial State β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Form Ready β”‚ β”‚ β€’ Empty input β”‚ β”‚ β€’ Default β”‚ β”‚ options β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ User Input │────▢│ Validation β”‚ β”‚ State β”‚ β”‚ State β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β–Ό β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Loading β”‚ β”‚ Error β”‚ β”‚ State β”‚ β”‚ State β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β–Ό β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Results β”‚ β”‚ Retry β”‚ β”‚ State β”‚ β”‚ State β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` --- ## πŸ›‘οΈ Security Features ### Security Measures Implemented 1. **Rate Limiting** - 100 requests per hour per IP address - Prevents abuse and DoS attacks 2. **Input Validation** - URL format validation - Protocol enforcement (HTTP/HTTPS) - Parameter sanitization 3. **SSL Certificate Analysis** - Certificate validity checking - Issuer verification - Expiration date monitoring 4. **Security Warnings** - SSL downgrade detection - Mixed content warnings - Redirect loop identification 5. **Response Sanitization** - Response body truncation (5000 chars max) - Header filtering - Error message sanitization ### Security Analysis Flow ``` URL Input β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Protocol β”‚ β”‚ Analysis β”‚ β”‚ (HTTP/HTTPS) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ SSL Cert β”‚ β”‚ Validation β”‚ β”‚ (if HTTPS) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Redirect β”‚ β”‚ Chain β”‚ β”‚ Analysis β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Security β”‚ β”‚ Warning β”‚ β”‚ Generation β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` --- ## βš™οΈ Technical Implementation ### Core Dependencies ```json { "axios": "^1.6.7", // HTTP client "express": "^4.18.2", // Web framework "express-rate-limit": "^5.5.1" // Rate limiting } ``` ### Key Technical Features 1. **Recursive Redirect Tracking** - Follows redirects programmatically - Captures metadata at each step - Handles relative/absolute URLs 2. **Custom HTTPS Agent** - SSL certificate extraction - Self-signed certificate handling - Security information gathering 3. **Request Configuration** - Custom headers support - User-agent spoofing - Timeout handling (15 seconds) 4. **Response Processing** - Content-type detection - Body size limitation - Header normalization ### Performance Considerations ``` Request Optimization β”œβ”€β”€ Connection reuse β”œβ”€β”€ Timeout management β”œβ”€β”€ Memory management β”‚ β”œβ”€β”€ Response truncation β”‚ └── Object cleanup └── Error boundary handling ``` ### Error Handling Strategy ``` Error Types β”œβ”€β”€ Network Errors β”‚ β”œβ”€β”€ Connection timeout β”‚ β”œβ”€β”€ DNS resolution β”‚ └── Connection refused β”œβ”€β”€ HTTP Errors β”‚ β”œβ”€β”€ 4xx Client errors β”‚ └── 5xx Server errors β”œβ”€β”€ Application Errors β”‚ β”œβ”€β”€ Invalid input β”‚ β”œβ”€β”€ Rate limit exceeded β”‚ └── Processing errors └── Security Errors β”œβ”€β”€ SSL certificate issues └── Protocol violations ``` --- ## πŸ“ˆ Future Enhancement Opportunities Based on the features document analysis, potential improvements include: 1. **Visual Enhancements** - Mermaid.js graph implementation - Interactive redirect visualization - Performance timeline charts 2. **Security Scanning** - Google Safe Browsing API integration - robots.txt analysis - Meta redirect detection 3. **Advanced Analysis** - Response time comparison - Geographic routing analysis - Cache-control header analysis 4. **Export Features** - JSON/CSV export - Report generation - Historical tracking --- ## 🎯 Conclusion The URL Redirect Tracker is a comprehensive tool that provides detailed analysis of HTTP redirect chains with strong security features and user-friendly interface. The current implementation covers core functionality with room for enhancement in visualization and advanced security scanning features. **Key Strengths:** - Robust redirect tracking with detailed metadata - Security-focused analysis (SSL, loops, downgrades) - Professional UI with dark mode and responsive design - Well-structured API with rate limiting - Comprehensive error handling **Architecture Benefits:** - Clean separation of concerns - RESTful API design - Scalable backend structure - Maintainable frontend code - Security-first approach