Skip to content

BrooksCunningham/http-me-rust

Repository files navigation

Test, build, and deploy

HTTP-ME: HTTP Testing Service

A lightweight HTTP testing and debugging service built on Fastly Compute@Edge. Inspired by httpbin, HTTP-ME provides endpoints for testing HTTP clients, debugging requests, and simulating various HTTP scenarios.

🌐 Live Service: https://http-me.edgecompute.app/

Features

  • βœ… Status Code Testing: Return any HTTP status code
  • πŸ” Request Inspection: Echo back request headers, body, and metadata
  • 🌍 IP Geolocation: Get geolocation data for any IP address
  • 🎨 Static Assets: Serve static files and interactive Swagger UI
  • 🐌 Tarpit Mode: Simulate slow responses for timeout testing
  • πŸ”§ Header Utilities: Test custom header handling
  • πŸ“‘ CORS Support: Built-in CORS support for cross-origin requests

Quick Start

Testing Status Codes

Return a specific HTTP status code:

# Get a 404 Not Found
curl -i https://http-me.edgecompute.app/status/404

# Get a 302 Redirect
curl -i https://http-me.edgecompute.app/status/302

# Get a 500 Internal Server Error
curl -i https://http-me.edgecompute.app/status/500

Inspecting Requests

Echo back all request data (headers, body, query params):

# Basic request inspection
curl https://http-me.edgecompute.app/anything/test

# With query parameters
curl https://http-me.edgecompute.app/anything/mypath?foo=bar&baz=qux

# With request body (POST)
curl -X POST https://http-me.edgecompute.app/anything/test \
  -H "Content-Type: application/json" \
  -d '{"key":"value"}'

Custom Status via Headers

Set a custom status code using headers at any path:

curl -i https://http-me.edgecompute.app/any/path \
  -H 'endpoint:status=302'

IP Geolocation

Get geolocation data for your IP or a specific IP:

# Get data for your own IP
curl https://http-me.edgecompute.app/client_ip_data

# Get data for a specific IP
curl https://http-me.edgecompute.app/client_ip_data?ip=8.8.8.8

Testing Custom Headers

Echo back custom headers prefixed with x-:

curl https://http-me.edgecompute.app/utilities/set_headers \
  -H "x-custom-header: my-value" \
  -H "x-another: test"

API Endpoints

Endpoint Description Example
/ Swagger UI documentation curl https://http-me.edgecompute.app/
/status/{code} Return specified HTTP status code curl -i https://http-me.edgecompute.app/status/404
/anything/{path} Echo request data as JSON curl https://http-me.edgecompute.app/anything/test
/client_ip_data Get IP geolocation data curl https://http-me.edgecompute.app/client_ip_data
/utilities/set_headers Echo custom headers curl https://http-me.edgecompute.app/utilities/set_headers -H "x-test: value"
/static-assets/{file} Serve static files curl https://http-me.edgecompute.app/static-assets/openapi-spec.json

Advanced Features

Tarpit Mode

Simulate slow responses for testing timeouts:

curl -H 'endpoint:tarpit=1' https://http-me.edgecompute.app/status/200

This will send the response in 100-byte chunks with a 1-second delay between each chunk.

Query Parameter Status

Alternative way to specify status codes:

curl -i 'https://http-me.edgecompute.app/any/path?status=404'

Development

Prerequisites

Local Development

  1. Clone the repository:

    git clone https://github.com/BrooksCunningham/http-me-rust.git
    cd http-me-rust
  2. Install dependencies:

    rustup target add wasm32-wasip1
    cargo build
  3. Run locally:

    fastly compute serve
  4. Test locally:

    curl http://localhost:7676/status/200
    curl http://localhost:7676/anything/test

See CONTRIBUTING.md for detailed development guidelines.

Deployment

This service is automatically deployed to Fastly Compute@Edge via GitHub Actions when changes are pushed to the main branch.

Deployment Process

  1. Test & Build: Code is compiled and tested
  2. WAF Testing: Tests run through Next-Gen WAF
  3. Deploy: Service is deployed to Fastly edge network
  4. KV Store Update: Static assets are uploaded to KV Store

See the GitHub Actions workflow in .github/workflows/test_build_deploy.yaml for details.

Architecture

Built on Fastly Compute@Edge, this service runs at the edge for:

  • ⚑ Low Latency: Responses from the nearest edge location
  • 🌍 Global Distribution: Available worldwide
  • πŸ”’ Security: Built-in DDoS protection and WAF
  • πŸ“ˆ Scalability: Automatically scales with traffic

Technology Stack

  • Language: Rust (compiled to WASM)
  • Platform: Fastly Compute@Edge
  • Storage: Fastly KV Store for static assets
  • CI/CD: GitHub Actions

Use Cases

  • HTTP Client Testing: Test your HTTP client implementation
  • API Development: Debug requests during development
  • Load Testing: Generate predictable responses for load tests
  • Integration Testing: Mock various HTTP scenarios
  • Network Debugging: Inspect what your application sends
  • Education: Learn about HTTP status codes and headers

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

Quick Contribution Guide

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with tests
  4. Submit a pull request

Security Issues

Please see SECURITY.md for guidance on reporting security-related issues.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments


Maintainer: Brooks Cunningham
Repository: github.com/BrooksCunningham/http-me-rust

About

http-me-rust

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •