Skip to content

HTTP File Server

HTTP file server converts the local file system directory into an HTTP server.

Usage

gost -L file://:8080?dir=/path/to/dir
services:
- name: service-0
  addr: :8080
  handler:
    type: file
    metadata:
      dir: /path/to/dir
  listener:
    type: tcp
dir (string):
local file directory, defaults to the current working directory.

Forwarding Chain

Forwarding chain will be ignored by file service.

Example

Simple HTTP File Server

Expose /home director to port 8080 as an HTTP service.

gost -L file://:8080?dir=/home
services:
- name: service-0
  addr: :8080
  handler:
    type: file
    metadata:
      dir: /home
  listener:
    type: tcp

Basic Authentication

Set up basic authentication for the service.

gost -L file://user:pass@:8080
services:
- name: service-0
  addr: :8080
  handler:
    type: file
    auth:
      username: user
      password: pass
  listener:
    type: tcp

TLS

Add a TLS encrypted transport layer (HTTPS) to the service.

gost -L file+tls://:8443
services:
- name: service-0
  addr: :8443
  handler:
    type: file
  listener:
    type: tls

Public Network Access

If you need to temporarily access the file service through the public network, you can use the public reverse proxy service provided by GOST.PLUS to anonymously expose the local file service to the public network for access.

gost -L file://:8080 -L rtcp://:0/:8080 -F tunnel+wss://tunnel.gost.plus:443

When connected to the GOST.PLUS server normally, there will be log information similar to the following:

{"connector":"tunnel","dialer":"wss","endpoint":"006478add9ed096a","hop":"hop-0","kind":"connector","level":"info",
"msg":"create tunnel on 006478add9ed096a:0/tcp OK, tunnel=50ce9728-5d92-4d45-871d-4f275d5179cb, connector=956fcbe5-6e2d-439a-8aa3-af0df848a81a",
"node":"node-0","time":"2023-10-19T22:41:05.759+08:00",
"tunnel":"50ce9728-5d92-4d45-871d-4f275d5179cb"}

The 006478add9ed096a in the endpoint field is a temporary public access point generated by server and is valid for 24 hour. This file service can be accessed immediately through https://006478add9ed096a.gost.plus.

Comments