Lightweight go web server that provides a searchable directory index.

autoindex

License: MPL 2.0

Lightweight go web server that provides a searchable directory index. Optimized for handling large numbers of files (100k+) and remote file systems (with high latency) through a continously updated directory cache.

Live demo

Features:

  • Lightweight single-page application (~8KB html/css/js)
  • Responsive design
  • Recursive file search
  • Directory cache (sqlite)
  • Sitemap support

Usage

./autoindex [options]

Flag Type Description
-a string TCP network address to listen for connections
-d string Database location
-r string Root directory to serve
-i string Refresh interval
-l int Request rate limit (req/sec per IP)
-t duration Request timeout
-forwarded bool Trust X-Real-IP and X-Forwarded-For headers
-cached bool Serve everything from cache (rather than search/recursive queries only)

Example

./autoindex -a=":4000" -i=5m -d=/tmp/autoindex.db -cached -r=/mnt/storage

Behind nginx

Example configuration for running autoindex behind an nginx proxy.

upstream autoindex {
    server 127.0.0.1:4000;
    keepalive 8;
}

map $request_uri $request_basename {
    ~/(?[^/?]*)(?:\?|$) $captured_request_basename;
}

map $request_uri $idx_path {
    ~/(?\?.*)?$                                $captured_request_args;
    ~/(?[^?]*)(?\?.*)?$ $captured_request_path/$captured_request_args;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name _;

    root /opt/autoindex/public;

    location / {
        rewrite ^/(.*)/$ /$1 permanent;
        try_files $uri /index.html;
        expires 1y;
    }

    location = /index.html {
        http2_push /idx/$idx_path;
        expires 1d;
    }

    location ^~ /dl/ {
        limit_rate 1m;
        add_header Content-Disposition 'attachment; filename="$request_basename"';
        add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
    }

    location ~ ^(/idx/|/urllist.txt) {
        proxy_pass http://autoindex;
    }
}
Similar Resources

Web server for running Brainfuck on the backend

Brainfuck Web Server Web server for running Brainfuck on the backend Run go run . brainfuck file The server will start on port 8080 by default. You

Oct 25, 2021

HTTP Echo is a go web server that echos back the arguments given to it.

HTTP Echo is a go web server that echos back the arguments given to it. This is especially useful for demos or a more extensive "hello world" application in Docker or Kubernetes.

Jan 3, 2023

A simple http-web server logging incoming requests to stdout with simple http-interface.

A simple http-web server logging incoming requests to stdout with simple http-interface.

http-cli-echo-logger A simple http-web server logging incoming requests to stdout with simple http-interface. Run locally go run ./cmd/main.go Default

Jul 18, 2022

Golang-redis-webserver - Web server using redis

Web Server using Redis Api REST Database SQLITE3 Cache Redis # Creating record s

Jun 19, 2022

a simple http server as replacement of python -m http.server

ser a simple http server as replacement of python -m http.server

Dec 5, 2022

OpenAPI specs for your Go server, generated at server runtime. No CLI, no code generation, and no HTTP

Overview "oas" is short for "OpenAPI Spec". Go package for generating OpenAPI docs at runtime. Non-features: No code generation. No CLI. No magic comm

Dec 3, 2021

A Language Server Protocol (LSP) server for Jsonnet

Jsonnet Language Server A Language Server Protocol (LSP) server for Jsonnet. Features Jump to definition self-support.mp4 dollar-support.mp4 Error/War

Dec 14, 2022

Formrecevr is a simple and lightweight from receiver backend primarily designed for (but not limited to) static websites.

Formrecevr Formrecevr (pronunced "Form receiver") is a simple and lightweight from receiver backend primarily designed for (but not limited to) static

Apr 17, 2022

A simple SHOUTcast server.

DudelDu DudelDu is a simple audio/video streaming server using the SHOUTcast protocol. Features Supports various streaming clients: VLC, ServeStream,

Nov 20, 2022
Comments
  • 404 page not found

    404 page not found

    Hello,

    everytime I try to server a directory, I get the error 404 page not found when accessing it via a browser.

    The commands I used are ./autoindex -a="0.0.0.0:4000" -r=/mnt/mydir

    and

    ./autoindex -a=":4000" -i=1m -d=/tmp/autoindex.db -r=/mnt/mydir

    The directory exists and is fully read- and writable by the user. I alsy tried to run it under root, same thing. I used version 1.0 from the release page on Debian 10.

    The log output shows nothing except Serving files in '/mn/mydir' on 0.0.0.0:4000 2357 records in database after update (+2357)

    Really looking forward to it, the demo looked great

  • How to build

    How to build

    When I try to build it, I meet the problem:

    walk/getdents_unix.go:54:13: undefined: syscall.Getdents
    
    ➜  ~ go version
    go version go1.14 darwin/amd64
    

    https://github.com/nielsAD/autoindex/blob/2ef921b14963226c5b38fef7b6b8806e73125240/walk/getdents_unix.go#L54

  • Dockerfile

    Dockerfile

    FYI, here is what I came up with

    RUN apt-get install -y golang git
    RUN go install github.com/nielsAD/autoindex@91a7b87c
    WORKDIR /opt
    RUN ln -s '/root/go/pkg/mod/github.com/niels!a!d/[email protected]/public'
    

    and I run /root/go/bin/autoindex

Go web server - A web server that can accept a GET request and serve a response.

go_web_server A web server that can accept a GET request and serve a response. Go is a great language for creating simple yet efficient web servers an

Jan 3, 2022
⚡ A fast, lightweight, and secure chat protocol, client and server, written in Go.

⚡ A fast, lightweight, and secure chat protocol, client and server, written in Go.

Oct 27, 2022
Ciak is a lightweight media server written in go
 Ciak is a lightweight media server written in go

Ciak allows you to show and stream your personal media tv series, movies, etc with a simple and clean web ui. The server also provide on the fly video encoding in order to stream non standard formats such as avi, mkv...

Jan 3, 2023
✨ A lightweight HTTP server based on GO, will try to detect your OS and architecture and return as SHELL script. ✨
✨ A lightweight HTTP server based on GO, will try to detect your OS and architecture and return as SHELL script. ✨

✨ A lightweight HTTP server based on GO, will try to detect your OS and architecture and return as SHELL script. ✨

Dec 14, 2022
:tophat: Small self-contained pure-Go web server with Lua, Markdown, HTTP/2, QUIC, Redis and PostgreSQL support
:tophat: Small self-contained pure-Go web server with Lua, Markdown, HTTP/2, QUIC, Redis and PostgreSQL support

Web server with built-in support for QUIC, HTTP/2, Lua, Markdown, Pongo2, HyperApp, Amber, Sass(SCSS), GCSS, JSX, BoltDB (built-in, stores the databas

Jan 1, 2023
Fast, multi-platform web server with automatic HTTPS
Fast, multi-platform web server with automatic HTTPS

a project Every site on HTTPS Caddy is an extensible server platform that uses TLS by default. Releases · Documentation · Get Help Menu Features Insta

Jan 1, 2023
Heart 💜A high performance Lua web server with a simple, powerful API
Heart 💜A high performance Lua web server with a simple, powerful API

Heart ?? A high performance Lua web server with a simple, powerful API. See the full documentation here. Overview Heart combines Go's fasthttp with Lu

Aug 31, 2022
Oogway is a simple web server with dynamic content generation and extendability in mind supporting a Git based workflow.

Oogway Oogway is a simple web server with dynamic content generation and extendability in mind supporting a Git based workflow. It's somewhere in betw

Nov 9, 2022
Static Content Web Server

Static Content Web Server The main purpose of the project is to develop static server that can be used with modern javascript frameworks (React, vue.j

Dec 17, 2021