|
๐ฅ๏ธ Go Monitor Live .htaccess file watching with beautiful terminal UI |
๐ Python Tester Comprehensive testing across 14+ countries |
๐ณ Docker Setup Containerized Apache with GeoIP simulation |

Real-time terminal UI application that monitors .htaccess file changes and automatically tests geo-redirection rules.
Features:
Comprehensive testing suite with multiple Google Bot user agents and detailed analysis.
Features:
Complete Docker environment for testing geo-redirection rules.
Features:
make docker-startmake go-binary (downloads pre-built binary).htaccess file at .htaccessgit clone https://github.com/tradik/htmonitor.git
cd red
make go-binary
make go-build
cd apps/htaccess-monitor && go mod tidy
pip install -r apps/python-tester/requirements.txt
3. Start services:
```bash
# Start Docker environment
make docker-start
# Run the monitor
make go-run
Start the real-time terminal monitor:
make go-run
The Go monitor can also watch your link scenarios and .htaccess and automatically re-run tests whenever those files change.
links.testing and .htaccessRun via Makefile:
make go-test-watch
Or run directly:
cd apps/htaccess-monitor
# Watch links.testing and .htaccess, re-run on changes
LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 \
go run main.go -test ../../links.testing -watch
Controls
f โ Toggle hide failsh โ Toggle hide passesq โ Quit watch modeCSV schema (links.testing)
Agent, Country, URL, Expected status, Expected result
Browser, US, http://localhost:8080/ , 200, No redirect
Googlebot, UK, http://localhost:8080/ , 200, No redirect
Browser, FR, http://localhost:8080/uk , 301, http://localhost:8080/uk/
Browser or Googlebot (case-insensitive)X-Test-Country.http://localhost:8080/uk/).No redirect.Matching rules
Location for a pass.No redirect, any redirect only fails if the status code does not match the expected status.Flow
sequenceDiagram
participant E as Editor
participant W as fsnotify Watcher
participant R as Test Runner
participant V as Terminal View
E->>W: Save links.testing or .htaccess
W-->>R: File change event (debounced 500ms)
R->>R: Parse CSV + run HTTP tests
R-->>V: Results (pass/fail, redirects)
V->>V: Render ANSI-aware table, filters applied
Tips
q to exit watch mode cleanly at any time.The make go-binary command uses GitHub CLI to download pre-built binaries:
# Auto-detect system architecture (default: linux-amd64)
make go-binary
# Specify custom architecture
ARCH=darwin-arm64 make go-binary
ARCH=windows-amd64.exe make go-binary
# Specify version
VERSION=1.1.0 make go-binary
# List available architectures
./scripts/download-binary.sh --list
Requirements:
gh) must be installed: https://cli.github.com/make go-build to compile from sourceSupported platforms:
Controls:
r - Run tests manuallyq - Quit applicationBasic Usage:
# Test localhost with default settings
cd apps/python-tester
python googlebot_spoof_tester.py --url http://localhost:8080
# Test with all Google Bot types
python googlebot_spoof_tester.py --url http://localhost:8080 --all-bots
Advanced Usage:
# Custom timeout and delay settings
python googlebot_spoof_tester.py --url http://localhost:8080 --timeout 60 --delay 2.0
# Save results to specific file
python googlebot_spoof_tester.py --url http://localhost:8080 --output test_results.json
# Run fancy bash script with country flags
./test_all_languages.sh
Setup and run:
# Start Docker environment
cd apps/docker-setup
docker-compose up -d
# View logs
docker-compose logs -f
# Stop environment
docker-compose down
Test URLs:
The Dockerized Apache exposes the site at http://localhost:8080/ and simulates GeoIP via the X-Test-Country HTTP header. You can also spoof the Googlebot user agent with -A.
Quick checks (headers only):
# Check redirect behavior for US visiting /uk and /uk/
curl -s -I -H "X-Test-Country: US" "http://localhost:8080/uk/" | grep -E "(HTTP|Location)"
curl -s -I -H "X-Test-Country: US" "http://localhost:8080/uk" | grep -E "(HTTP|Location)"
# Simulate Googlebot from DE (Germany) hitting root and /uk/
curl -s -A "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" -H "X-Test-Country: DE" "http://localhost:8080/" && echo ""
curl -s -A "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" -H "X-Test-Country: DE" "http://localhost:8080/uk/" && echo ""
curl -s -A "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" -H "X-Test-Country: DE" "http://localhost:8080/uk/"
Notes:
-H "X-Test-Country: <CC>" sets the simulated country (e.g., US, DE, FR, UK).-A "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" spoofs Googlebot.-I returns headers only (useful to inspect HTTP status and Location)..htaccess rules.graph TB
A[Go Monitor] --> B[.htaccess Watcher]
A --> C[HTTP Test Runner]
D[Python Tester] --> E[Google Bot Spoofer]
D --> F[Multi-Country Tests]
G[Docker Setup] --> H[Apache Server]
G --> I[GeoIP Mock]
J[Shared Packages] --> K[.htaccess Rules]
J --> L[GeoIP Mock Service]
B --> K
C --> H
E --> H
F --> H
git checkout -b feature/amazing-featuregit commit -m 'Add amazing feature'git push origin feature/amazing-featureThe Go application includes comprehensive test coverage:
# Run unit tests
make go-test
# Run with coverage report
make go-test-coverage
# Run integration tests
make go-test-integration
# Run benchmarks
make go-test-bench
# Run all tests
make go-test-all
Test Coverage: 19.5% of statements (focused on business logic)
For detailed testing documentation, see apps/htaccess-monitor/TEST_README.md
Automated workflows ensure code quality and streamlined releases:
๐ Lint Workflow (on push/PR to main/develop)
go vet, go fmt, and golangci-lint๐ Release Workflow (on merge to main)
For workflow details, see .github/workflows/README.md
This project is licensed under a Commercial License - see the LICENSE file for details.
Copyright 2025 Tradik Limited. All rights reserved.
This software is proprietary and confidential. Unauthorized copying, distribution, or use is strictly prohibited. For licensing inquiries, contact: legal@tradik.com
Go Monitor not starting:
cd apps/htaccess-monitor
go mod tidy
go run main.go
Python tests failing:
cd apps/python-tester
pip install -r requirements.txt
python googlebot_spoof_tester.py --url http://localhost:8080
Docker services not accessible:
cd apps/docker-setup
docker-compose down
docker-compose up -d
docker-compose logs -f for service logsred/
โโโ apps/ # Main applications
โ โโโ htaccess-monitor/ # Go terminal UI monitor
โ โ โโโ main.go
โ โ โโโ go.mod
โ โ โโโ go.sum
โ โ โโโ README.md
โ โโโ python-tester/ # Python testing suite
โ โ โโโ googlebot_spoof_tester.py
โ โ โโโ test_all_languages.sh
โ โ โโโ requirements.txt
โ โ โโโ README.md
โ โโโ docker-setup/ # Docker configuration
โ โ โโโ Dockerfile
โ โ โโโ docker-compose.yml
โ โ โโโ apache-vhost.conf
โ โ โโโ README.md
โ โโโ test-scripts/ # Testing utilities
โ โโโ test-countries.sh
โโโ packages/ # Shared packages
โ โโโ shared/ # Common configurations
โ โโโ .htaccess # Geo-redirection rules
โ โโโ geoip-mock.php # GeoIP mock service
โ โโโ README.md
โโโ docs/ # Documentation
โ โโโ ARCHITECTURE.md # System architecture
โ โโโ HTACCESS_DOCUMENTATION.md # .htaccess guide
โ โโโ README-DOCKER.md # Docker setup guide
โโโ logs/ # Application logs
โ โโโ access.log
โ โโโ error.log
โ โโโ other_vhosts_access.log
โโโ Makefile # Build automation
โโโ CHANGELOG.md # Version history
โโโ workspace.json # Workspace configuration
โโโ README.md # This file
See CHANGELOG.md for version history and updates.