{"id":22758664,"url":"https://github.com/mjpclab/extra-http-file-server","last_synced_at":"2025-04-14T18:21:33.845Z","repository":{"id":64300967,"uuid":"532293808","full_name":"mjpclab/extra-http-file-server","owner":"mjpclab","description":"Simple static web server. Based on Go HTTP File Server(https://github.com/mjpclab/go-http-file-server).","archived":false,"fork":false,"pushed_at":"2025-02-05T14:53:17.000Z","size":198,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T11:01:57.421Z","etag":null,"topics":["cli","go","http-server","static-server"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mjpclab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2022-09-03T15:07:43.000Z","updated_at":"2025-01-17T15:43:57.000Z","dependencies_parsed_at":"2023-11-26T04:23:09.074Z","dependency_job_id":"fe61f924-2fd9-4cc6-b907-6d8092c8fc4f","html_url":"https://github.com/mjpclab/extra-http-file-server","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjpclab%2Fextra-http-file-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjpclab%2Fextra-http-file-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjpclab%2Fextra-http-file-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjpclab%2Fextra-http-file-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mjpclab","download_url":"https://codeload.github.com/mjpclab/extra-http-file-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248933349,"owners_count":21185461,"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":["cli","go","http-server","static-server"],"created_at":"2024-12-11T08:15:12.762Z","updated_at":"2025-04-14T18:21:33.810Z","avatar_url":"https://github.com/mjpclab.png","language":"Go","readme":"# Extra HTTP File Server\n\nExtra HTTP File Server is based on Go HTTP File Server, with extra features.\nIt provides frequently used features for a simple static website.\n\n![Extra HTTP File Server pages](doc/ehfs.gif)\n\n# Different to Go HTTP File Server\n\n## Code base\n\nBased on Go HTTP File Server's main branch, dropped support for legacy Go version.\nThis means it is impossible to use legacy Go version to compile binaries for legacy systems, e.g. Windows XP.\n\n## Changed behavior\nFor PKI validation URL `/.well-known/`,\nwill skip redirecting from http: to https: even `--to-https` is specified.\n\n## New options\n\n```\n--ip-allow \u003cIP\u003e|\u003cnetwork/prefix\u003e ...\n--ip-allow-file \u003cfile\u003e ...\n    Only allow client access from specific IP or network.\n    Unmatched client IP will be denied.\n\n--ip-deny \u003cIP\u003e|\u003cnetwork/prefix\u003e ...\n--ip-deny-file \u003cfile\u003e ...\n    Only denly client access from specific IP or network.\n    Unmatched client IP will be allowed to access.\n\n--rewrite-host \u003cseparator\u003e\u003cmatch\u003e\u003cseparator\u003e\u003creplace\u003e\n    Transform a request host+URL (in the form of \"host[:port]/request/path?param=value\")\n    into another URL if it is matched by regular expression `match`.\n\n    The rewrite target is specified by `replace`.\n    Use `$0` to represent the whole match in `match`.\n    use `$1` - `$9` to represent sub matches in `match`.\n--rewrite-host-post \u003csep\u003e\u003cmatch\u003e\u003csep\u003e\u003creplace\u003e\n    Similar to --rewrite-host, but executes after redirects has no match.\n--rewrite-host-end \u003csep\u003e\u003cmatch\u003e\u003csep\u003e\u003creplace\u003e\n    Similar to --rewrite-host-post, but skip rest process if matched.\n\n--rewrite \u003cseparator\u003e\u003cmatch\u003e\u003cseparator\u003e\u003creplace\u003e\n    Transform a request URL (in the form of \"/request/path?param=value\")\n    into another one if it is matched by regular expression `match`.\n\n    The rewrite target is specified by `replace`.\n    Use `$0` to represent the whole match in `match`.\n    use `$1` - `$9` to represent sub matches in `match`.\n--rewrite-post \u003csep\u003e\u003cmatch\u003e\u003csep\u003e\u003creplace\u003e\n    Similar to --rewrite, but executes after redirects has no match.\n--rewrite-end \u003csep\u003e\u003cmatch\u003e\u003csep\u003e\u003creplace\u003e\n    Similar to --rewrite-post, but skip rest process if matched.\n\n--redirect \u003cseparator\u003e\u003cmatch\u003e\u003cseparator\u003e\u003creplace\u003e[\u003cseparator\u003e\u003cstatus-code\u003e]\n    Perform an HTTP redirect when request URL (in the form of \"/request/path?param=value\")\n    is matched by regular expression `match`.\n\n    The redirect target is specified by `replace`.\n    Use `$0` to represent the whole match in `match`.\n    use `$1` - `$9` to represent sub matches in `match`.\n\n    Optional `status_code` specifies HTTP redirect code. defaults to 301.\n\n--proxy \u003cseparator\u003e\u003cmatch\u003e\u003cseparator\u003e\u003creplace\u003e\n    Proxy a request URL (in the form of \"/request/path?param=value\")\n    to target if it is matched by regular expression `match`.\n\n    The proxy target is specified by `replace`.\n    Use `$0` to represent the whole match in `match`.\n    use `$1` - `$9` to represent sub matches in `match`.\n\n--return \u003cseparator\u003e\u003cmatch\u003e\u003cseparator\u003e\u003cstatus-code\u003e\n    When request URL (in the form of \"/request/path?param=value\")\n    is matched by `match`, return the status code `status-code`\n    immediately and stop processing.\n--to-status \u003cseparator\u003e\u003cmatch\u003e\u003cseparator\u003e\u003cstatus-code\u003e\n    Similar to --return, but process after ghfs internal process finished.\n\n--status-page \u003cseparator\u003e\u003cstatus-code\u003e\u003cseparator\u003e\u003cfs-path\u003e\n    When response status is `status-code`, respond with the file content from `fs-path`.\n\n--gzip-static\n    When requesting for FILE, if client supports gzip decoding, try looking for and\n    outputing FILE.gz as gzip compressed content.\n\n--header-add \u003cseparator\u003e\u003cmatch\u003e\u003cseparator\u003e\u003cname\u003e\u003cseparator\u003e\u003cvalue\u003e\n--header-set \u003cseparator\u003e\u003cmatch\u003e\u003cseparator\u003e\u003cname\u003e\u003cseparator\u003e\u003cvalue\u003e\n    Add or set response header if URL(in the form of \"/request/path?param=value\")\n    matches `match`.\n```\n\n## Processing order\n\n- if client IP not match `--ip-allow` or `--ip-allow-file`, return status 403, and stop processing\n  - `--status-page` executed if status code matched, and stop processing.\n- if client IP match `--ip-deny` or `--ip-deny-file`, return status 403, and stop processing\n  - `--status-page` executed if status code matched, and stop processing.\n- `--rewrite-host` and `--rewrite` executed to transform the URL if matched.\n- `--redirect` executed if URL matched, and stop processing.\n- `--rewrite-host-post` and `--rewrite-post` executed to transform the URL if matched.\n- `--rewrite-host-end` and `--rewrite-end` executed to transform the URL if matched, and skip rest processes like `--rewrite[-host]-end`, `--proxy` `--return`, etc.\n- `--proxy` executed if URL matched, and stop processing.\n  - `--header-add` and `--header-set` executed if URL matched, and stop processing.\n- `--return` executed if URL matched, and stop processing.\n  - `--header-add` and `--header-set` executed if URL matched, and stop processing.\n  - `--status-page` executed if status code matched, and stop processing.\n- ghfs internal process\n- `--header-add` and `--header-set` executed if URL matched.\n- `--to-status` executed if URL matched, and stop processing.\n  - `--status-page` executed if status code matched, and stop processing.\n- `--status-page` executed if status code matched, and stop processing.\n\n## Examples\n\nPerform redirect according to `redirect` param:\n\n```sh\n# when requesting http://localhost:8080/redirect/www.example.com, redirect to https://www.example.com\nehfs -l 8080 -r /path/to/share --redirect '#/redirect/(.*)#https://$1'\n```\n\nServe static page without `.html` suffix in URL:\n- redirect URL contains `.html` suffix to no suffix\n- rewrite URL without suffix to with `.html` suffix \n\n```sh\nehfs -l 8080 -r /path/to/share --redirect '#(.*)\\.html#$1' --rewrite-post '#^.*/[^/.]+$#$0.html'\n```\n\nSpecify page for 404 status:\n\n```sh\nehfs -l 8080 -r /path/to/share --status-page '#404#/path/to/404/file'\n```\n\nRefuse to serve for critical files or directories, returns 403 status:\n\n```sh\nehfs -l 8080 -r /path/to/share --return '#.git|.htaccess#403'\n```\n\n## Compile\nMinimal required Go version is 1.20.\n```sh\ngo build main.go\n```\nWill generate executable file \"main\" in current directory.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjpclab%2Fextra-http-file-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmjpclab%2Fextra-http-file-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjpclab%2Fextra-http-file-server/lists"}