{"id":13447271,"url":"https://github.com/codeskyblue/gohttpserver","last_synced_at":"2025-05-13T17:11:05.220Z","repository":{"id":37359607,"uuid":"63852314","full_name":"codeskyblue/gohttpserver","owner":"codeskyblue","description":"The best HTTP Static File Server, write with golang+vue","archived":false,"fork":false,"pushed_at":"2025-03-13T00:29:02.000Z","size":3572,"stargazers_count":2661,"open_issues_count":107,"forks_count":550,"subscribers_count":56,"default_branch":"master","last_synced_at":"2025-04-10T20:53:21.979Z","etag":null,"topics":["go","httpserver"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/codeskyblue.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,"publiccode":null,"codemeta":null}},"created_at":"2016-07-21T08:41:09.000Z","updated_at":"2025-04-05T13:13:22.000Z","dependencies_parsed_at":"2024-04-19T13:46:57.976Z","dependency_job_id":"72c68f77-ba2c-4114-9174-4fd3c30ee9ff","html_url":"https://github.com/codeskyblue/gohttpserver","commit_stats":{"total_commits":269,"total_committers":18,"mean_commits":"14.944444444444445","dds":"0.20446096654275092","last_synced_commit":"fdd6ff94353113e092b428352664de0150b29d70"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeskyblue%2Fgohttpserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeskyblue%2Fgohttpserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeskyblue%2Fgohttpserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeskyblue%2Fgohttpserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codeskyblue","download_url":"https://codeload.github.com/codeskyblue/gohttpserver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250529185,"owners_count":21445594,"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":["go","httpserver"],"created_at":"2024-07-31T05:01:12.558Z","updated_at":"2025-04-23T23:19:23.557Z","avatar_url":"https://github.com/codeskyblue.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","开源类库","Open source library","Repositories","10、基础服务架构"],"sub_categories":["文件/存储","Files/Storage","9、效率工具集合"],"readme":"# gohttpserver\n[![Docker Automated build](https://img.shields.io/docker/automated/codeskyblue/gohttpserver)](https://hub.docker.com/repository/docker/codeskyblue/gohttpserver)\n\n**I've recently ported a new one using Python. Have a look at it here: https://github.com/codeskyblue/servefs**\n\n- Goal: Make the best HTTP File Server.\n- Features: Human-friendly UI, file uploading support, direct QR-code generation for Apple \u0026 Android install package.\n\n- 目标: 做最好的HTTP文件服务器\n- 功能: 人性化的UI体验，文件的上传支持，安卓和苹果安装包的二维码直接生成。\n\n**Binaries** can be downloaded from [this repo releases](https://github.com/codeskyblue/gohttpserver/releases/)\n\n## Requirements\nTested with go-1.16\n\n## Screenshots\n![screen](testdata/filetypes/gohttpserver.gif)\n\n## Features\n1. [x] Support QRCode code generate\n1. [x] Breadcrumb path quick change\n1. [x] All assets package to Standalone binary\n1. [x] Different file type different icon\n1. [x] Support show or hide hidden files\n1. [x] Upload support (auth by token or session)\n1. [x] README.md preview\n1. [x] HTTP Basic Auth\n1. [x] Partial reload pages when directory change\n1. [x] When only one dir under dir, path will combine two together\n1. [x] Directory zip download\n1. [x] Apple ipa auto generate .plist file, qrcode can be recognized by iphone (Require https)\n1. [x] Plist proxy\n1. [ ] Download count statistics\n1. [x] CORS enabled\n1. [ ] Offline download\n1. [ ] Code file preview\n1. [ ] Edit file support\n1. [x] Global file search\n1. [x] Hidden work `download` and `qrcode` in small screen\n1. [x] Theme select support\n1. [x] OK to working behide Nginx\n1. [x] \\.ghs.yml support (like \\.htaccess)\n1. [ ] Calculate md5sum and sha\n1. [ ] Folder upload\n1. [ ] Support sort by size or modified time\n1. [x] Add version info into index page\n1. [ ] Add api `/-/info/some.(apk|ipa)` to get detail info\n1. [x] Add api `/-/apk/info/some.apk` to get android package info\n1. [x] Auto tag version\n1. [x] Custom title support\n1. [x] Support setting from conf file\n1. [x] Quick copy download link\n1. [x] Show folder size\n1. [x] Create folder\n1. [x] Skip delete confirm when alt pressed\n1. [x] Support unzip zip file when upload(with form: unzip=true)\n\n## Installation\n```bash\n$ go install github.com/codeskyblue/gohttpserver@latest\n```\n\nOr download binaries from [github releases](https://github.com/codeskyblue/gohttpserver/releases)\n\nIf you are using Mac, simply run command\n\n```bash\n$ brew install codeskyblue/tap/gohttpserver\n```\n\n## Usage\nListen on port 8000 of all interfaces, and enable file uploading.\n\n```\n$ gohttpserver -r ./ --port 8000 --upload\n```\n\nUse command `gohttpserver --help` to see more usage.\n\n## Docker Usage\nshare current directory\n\n```bash\n$ docker run -it --rm -p 8000:8000 -v $PWD:/app/public --name gohttpserver codeskyblue/gohttpserver\n```\n\nShare current directory with http basic auth\n\n```bash\n$ docker run -it --rm -p 8000:8000 -v $PWD:/app/public --name gohttpserver \\\n  codeskyblue/gohttpserver \\\n  --auth-type http --auth-http username1:password1 --auth-http username2:password2\n```\n\nShare current directory with openid auth. (Works only in netease company.)\n\n```bash\n$ docker run -it --rm -p 8000:8000 -v $PWD:/app/public --name gohttpserver \\\n  codeskyblue/gohttpserver \\\n  --auth-type openid\n```\n\nTo build image yourself, please change the PWD to the root of this repo.\n\n```bash\n$ cd gohttpserver/\n$ docker build -t codeskyblue/gohttpserver -f docker/Dockerfile .\n```\n\n## Authentication options\n- Enable basic http authentication\n\n  ```sh\n  $ gohttpserver --auth-type http --auth-http username1:password1 --auth-http username2:password2\n  ```\n\n- Use openid auth\n\n  ```sh\n  $ gohttpserver --auth-type openid --auth-openid https://login.example-hostname.com/openid/\n  ```\n\n- Use oauth2-proxy with\n\n  ```sh\n  $ gohttpserver --auth-type oauth2-proxy\n  ```\n  You can configure to let a http reverse proxy handling authentication. \n  When using oauth2-proxy, the backend will use identification info from request headers `X-Auth-Request-Email` as userId and `X-Auth-Request-Fullname` as user's display name. \n  Please config your oauth2 reverse proxy yourself.\n  More about [oauth2-proxy](https://github.com/oauth2-proxy/oauth2-proxy).\n  \n  All required headers list as following.\n\n  |header|value|\n  |---|---|\n  |X-Auth-Request-Email| userId |\n  |X-Auth-Request-Fullname| user's display name(urlencoded) |\n  |X-Auth-Request-User| user's nickname (mostly email prefix) |\n\n- Enable upload\n\n  ```sh\n  $ gohttpserver --upload\n  ```\n\n- Enable delete and Create folder\n\n  ```sh\n  $ gohttpserver --delete\n  ```\n\n## Advanced usage\nAdd access rule by creating a `.ghs.yml` file under a sub-directory. An example:\n\n```yaml\n---\nupload: false\ndelete: false\nusers:\n- email: \"codeskyblue@codeskyblue.com\"\n  delete: true\n  upload: true\n  token: 4567gf8asydhf293r23r\n```\n\nIn this case, if openid auth is enabled and user \"codeskyblue@codeskyblue.com\" has logged in, he/she can delete/upload files under the directory where the `.ghs.yml` file exits.\n\n`token` is used for upload. see [upload with curl](#upload-with-curl)\n\nFor example, in the following directory hierarchy, users can delete/uploade files in directory `foo`, but he/she cannot do this in directory `bar`.\n\n```\nroot -\n  |-- foo\n  |    |-- .ghs.yml\n  |    `-- world.txt \n  `-- bar\n       `-- hello.txt\n```\n\nUser can specify config file name with `--conf`, see [example config.yml](testdata/config.yml).\n\nTo specify which files is hidden and which file is visible, add the following lines to `.ghs.yml`\n\n```yaml\naccessTables:\n- regex: block.file\n  allow: false\n- regex: visual.file\n  allow: true\n```\n\n### ipa plist proxy\nThis is used for server on which https is enabled. default use \u003chttps://plistproxy.herokuapp.com/plist\u003e\n\n```bash\n$ gohttpserver --plistproxy=https://someproxyhost.com/\n```\n\nTest if proxy works:\n\n```sh\n$ http POST https://someproxyhost.com/plist \u003c app.plist\n{\n\t\"key\": \"18f99211\"\n}\n$ http GET https://someproxyhost.com/plist/18f99211\n# show the app.plist content\n```\n\nIf your ghs running behide nginx server and have https configed. plistproxy will be disabled automaticly.\n\n### Upload with CURL\nFor example, upload a file named `foo.txt` to directory `somedir`\n\n```sh\n$ curl -F file=@foo.txt localhost:8000/somedir\n{\"destination\":\"somedir/foo.txt\",\"success\":true}\n# upload with token\n$ curl -F file=@foo.txt -F token=12312jlkjafs localhost:8000/somedir\n{\"destination\":\"somedir/foo.txt\",\"success\":true}\n\n# upload and change filename\n$ curl -F file=@foo.txt -F filename=hi.txt localhost:8000/somedir\n{\"destination\":\"somedir/hi.txt\",\"success\":true}\n```\n\nUpload zip file and unzip it (zip file will be delete when finished unzip)\n\n```\n$ curl -F file=@pkg.zip -F unzip=true localhost:8000/somedir\n{\"success\": true}\n```\n\nNote: `\\/:*\u003c\u003e|` are not allowed in filenames.\n\n### Deploy with nginx\nRecommended configuration, assume your gohttpserver listening on `127.0.0.1:8200`\n\n```\nserver {\n  listen 80;\n  server_name your-domain-name.com;\n\n  location / {\n    proxy_pass http://127.0.0.1:8200; # here need to change\n    proxy_redirect off;\n    proxy_set_header  Host    $host;\n    proxy_set_header  X-Real-IP $remote_addr;\n    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;\n    proxy_set_header  X-Forwarded-Proto $scheme;\n\n    client_max_body_size 0; # disable upload limit\n  }\n}\n```\n\ngohttpserver should started with `--xheaders` argument when behide nginx.\n\nRefs: \u003chttp://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size\u003e\n\ngohttpserver also support `--prefix` flag which will help to when meet `/` is occupied by other service. relative issue \u003chttps://github.com/codeskyblue/gohttpserver/issues/105\u003e\n\nUsage example:\n\n```bash\n# for gohttpserver\n$ gohttpserver --prefix /foo --addr :8200 --xheaders\n```\n\n**Nginx settigns**\n\n```\nserver {\n  listen 80;\n  server_name your-domain-name.com;\n\n  location /foo {\n    proxy_pass http://127.0.0.1:8200; # here need to change\n    proxy_redirect off;\n    proxy_set_header  Host    $host;\n    proxy_set_header  X-Real-IP $remote_addr;\n    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;\n    proxy_set_header  X-Forwarded-Proto $scheme;\n\n    client_max_body_size 0; # disable upload limit\n  }\n}\n```\n\n## FAQ\n- [How to generate self signed certificate with openssl](http://stackoverflow.com/questions/10175812/how-to-create-a-self-signed-certificate-with-openssl)\n\n### How the query is formated\nThe search query follows common format rules just like Google. Keywords are seperated with space(s), keywords with prefix `-` will be excluded in search results.\n\n1. `hello world` means must contains `hello` and `world`\n1. `hello -world` means must contains `hello` but not contains `world`\n\n## Developer Guide\nDepdencies are managed by [govendor](https://github.com/kardianos/govendor)\n\n1. Build develop version. **assets** directory must exists\n\n  ```sh\n  $ go build\n  $ ./gohttpserver\n  ```\n2. Build single binary release\n\n  ```sh\n  $ go build\n  ```\n\nTheme are defined in [assets/themes](assets/themes) directory. Now only two themes are available, \"black\" and \"green\".\n\n\n## Reference Web sites\n\n* Core lib Vue \u003chttps://vuejs.org.cn/\u003e\n* Icon from \u003chttp://www.easyicon.net/558394-file_explorer_icon.html\u003e\n* Code Highlight \u003chttps://craig.is/making/rainbows\u003e\n* Markdown Parser \u003chttps://github.com/showdownjs/showdown\u003e\n* Markdown CSS \u003chttps://github.com/sindresorhus/github-markdown-css\u003e\n* Upload support \u003chttp://www.dropzonejs.com/\u003e\n* ScrollUp \u003chttps://markgoodyear.com/2013/01/scrollup-jquery-plugin/\u003e\n* Clipboard \u003chttps://clipboardjs.com/\u003e\n* Underscore \u003chttp://underscorejs.org/\u003e\n\n**Go Libraries**\n\n* [vfsgen](https://github.com/shurcooL/vfsgen) Not using now\n* [go-bindata-assetfs](https://github.com/elazarl/go-bindata-assetfs) Not using now\n* \u003chttp://www.gorillatoolkit.org/pkg/handlers\u003e\n\n## History\nThe old version is hosted at \u003chttps://github.com/codeskyblue/gohttp\u003e\n\n## LICENSE\nThis project is licensed under [MIT](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeskyblue%2Fgohttpserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeskyblue%2Fgohttpserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeskyblue%2Fgohttpserver/lists"}