{"id":26649008,"url":"https://github.com/lucasepe/drop","last_synced_at":"2026-05-02T09:34:18.883Z","repository":{"id":284046878,"uuid":"953647201","full_name":"lucasepe/drop","owner":"lucasepe","description":"Lightweight HTTP server for serving static files from a specified directory","archived":false,"fork":false,"pushed_at":"2025-03-23T20:53:00.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T21:31:52.753Z","etag":null,"topics":["development","golang","static-http-server"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lucasepe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-23T20:33:00.000Z","updated_at":"2025-03-23T20:53:04.000Z","dependencies_parsed_at":"2025-03-23T21:31:54.601Z","dependency_job_id":"a2c20455-937c-44e7-b243-f421ab7a1223","html_url":"https://github.com/lucasepe/drop","commit_stats":null,"previous_names":["lucasepe/drop"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasepe%2Fdrop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasepe%2Fdrop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasepe%2Fdrop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasepe%2Fdrop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucasepe","download_url":"https://codeload.github.com/lucasepe/drop/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245377954,"owners_count":20605375,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["development","golang","static-http-server"],"created_at":"2025-03-25T00:47:42.514Z","updated_at":"2026-05-02T09:34:18.867Z","avatar_url":"https://github.com/lucasepe.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"```\n┌┬┐┬─┐┌─┐┌─┐\n ││├┬┘│ │├─┘\n─┴┘┴└─└─┘┴  \n```\n\n\u003e Lightweight and secure HTTP server for hosting static files from a specified directory\n\nOverview\n========\n\nDrop is a lightweight and secure HTTP server for hosting static files from a specified directory.\n\nThis project is useful for various scenarios, including:\n\n- Testing WebAssembly (WASM) applications - without the need for a complex web server\n- Sharing files between machines - over a local network\n- Hosting simple static websites - for development purposes\n- Providing a lightweight file access point - for devices in an IoT network\n\nFeatures\n========\n\n- 📂 Serves static files from a specified directory\n- 📑 Automatically generates a stylish index if index.html is missing\n- 📜 Consistent MIME type resolution across different environments\n- 👀 Access Log\n- 🔒 Basic Authentication for access\n- 🧩 Customizable HTTP response headers for specific file\n- 🔥 Dynamic HTTP response headers for specific file\n- 🔐 HTTPS/TLS support for encrypted communication\n- 👮‍♀️ Prevent Dot Files Access (e.g., .env, .gitignore)\n- 👮‍♀️ Prevent Symlink Access\n- 📡 Support for OPTIONS requests, returning allowed HTTP methods\n- ⚡ Proper handling of HEAD requests (returns headers like Content-Type and Content-Length plus your custom headers)\n- ⛔ Blocks unsupported HTTP methods (POST, PUT, DELETE, etc.) with 405 Method Not Allowed\n- 🚀 Graceful shutdown on termination signals\n\n# How To\n\n## Installation\n\nYou can install `drop` using different methods depending on your operating system.  \n\n### macOS (Homebrew)\n\nThe easiest way to install `drop` on macOS is via Homebrew:  \n\n```sh\nbrew install lucasepe/cli-tools/drop\n```\n\n### Windows \u0026 Linux \n\n#### Download Prebuilt Binaries\n\n- Go to the [Releases](https://github.com/lucasepe/drop/releases) section.  \n- Download the latest binary for your OS and Arch.  \n- Add it to your system's `$PATH` if necessary.  \n\n#### Alternative: Install via `go install` (requires Go installed)\n\nIf you have Go installed, you can install `drop` directly with:  \n\n```sh\ngo install github.com/lucasepe/drop@latest\n```  \n\nThis will place the binary in `$GOPATH/bin` (or `$HOME/go/bin` if `$GOPATH` is not set).\n\nEnsure this path is in your `$PATH` to use `drop` globally.  \n\n\n## Basic Authentication\n\nTo enable Basic Authentication put into the serving folder an `.users` file.\n\nThis is a flat file that contains the user name and the SHA-256 crypt hashed password for each user.\n\n`.users` file sample:\n\n```\nadmin:$5$azZ$NH//nNpYkwzlwe03A4ZmLxZz0lQTmJ0Ongj9KIfC6o6\n```\n\nYou can generate each row using openssl:\n\n```\nprintf \"admin:$(openssl passwd -5 -salt 'azZ' '12345')\\n\"\n```\n\n## Custom HTTP Response Headers\n\n`drop` allows you to define custom HTTP response headers based on file request patterns.  \n\nHeaders are defined in a custom `.headers` file (similar to an `.ini` format). \n\nThe general structure follows:  \n\n- **global headers** (applied to all responses)\n- **pattern-based headers** (applied only to matching file paths)\n\n\n**How it works**\n\n- patterns follow **glob-style matching** (e.g., `*.js` matches all JavaScript files)\n- if a request matches multiple patterns, only the first match is applied\n- global headers are **always applied first**, followed by any matching pattern-specific headers\n\n\n**Example**  \n\n```yaml\n# Global headers (applied to all responses)\nX-Greeting: Hello World!\n\n# Pattern-based headers\n[*.mod]\nX-Type: Go Module File\n```\n\n## Custom dynamic HTTP Headers \n\n`drop` allows also dynamic values based on the request and server state. \n\nHere’s a list of possible variables:  \n\n| **Variable** | **Description** | **Example Value** | **Use Case**           |\n|--------------|-----------------|-------------------|------------------------|\n| `SERVER_ADDR` | Server IP and port | `192.168.1.10:8080` | CSP, CORS  |\n| `SERVER_NAME` | Server hostname | `example.com` | CSP, logging |\n| `REMOTE_ADDR` | Client IP address | `203.0.113.45` | CORS, security         |\n| `REQUEST_URI` | Full request URI (path + query string) | `/static/libs/hello.wasm?a=xxxx`| Debugging |\n| `REQUEST_PATH` | Request path only | `/libs/hello.wasm` | CSP, CORS |\n| `USER_AGENT`   | Client's User-Agent | `Mozilla/5.0 (Windows NT 10.0...)` | Security, analytics |\n| `REFERER`      | Referrer URL of the request | `https://google.com/` | Security, analytics |\n\nWhen defining your custom headers, you can use these variables by enclosing them with the prefix `${` and the suffix `}`\n\n**Example**\n\n```yaml\n# https://content-security-policy.com/examples/\nContent-Security-Policy: default-src 'self'; img-src 'self'; style-src 'unsafe-inline' http://${SERVER_ADDR} https://${SERVER_ADDR} https://cdnjs.cloudflare.com;\nX-Content-Type-Options: nosniff\nX-Frame-Options: DENY\nX-XSS-Protection: 1; mode=block\n\n# No Cache (for debug)\n[*.wasm]\nCache-Control: no-store, no-cache, must-revalidate, max-age=0\nPragma: no-cache\nExpires: 0\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucasepe%2Fdrop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucasepe%2Fdrop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucasepe%2Fdrop/lists"}