HTTP API Reference

Last updated


This page lists every HTTP endpoint of go-image-server, the response format of each, and their shared behavior.

Endpoints


MethodPathHandlerDetails
GET/c/img/*pathhandlers.GetFromPathImage Parameters
POST/upload/*pathhandlers.PostToPathUpload API
DELETE/del/*pathhandlers.DeleteFromPathDelete API
GET/check/statehandleHealthCheckReturns 200 ok
AnyOther pathsroutes.Set404Returns 404 Not Found

*path is a Gin wildcard parameter and may contain multiple / segments; handlers trim leading and trailing /.

Response Formats


EndpointSuccessFailure
GET /c/img/*pathImage or PDF bytes (chunked)Placeholder SVG served with status 200 (Cache-Control: no-cache); a missing .pdf / .svg / o=1 original returns 404 File not found
POST /upload/*path201 JSONPlain-text error message
DELETE /del/*path200 JSONPlain-text error message

Upload and delete errors go through utils.HandleError, which responds with plain text and logs two [ERROR] lines; read errors go through utils.HandleGetError, which returns the placeholder.

Timeouts


All three handlers work in a goroutine and wait on it with context.WithTimeout(30s). Past 30 seconds they return 408 with timed out. Nginx additionally sets proxy_read_timeout / proxy_send_timeout to 120 seconds for /c/img/.

Access Control


The Go service performs no authentication. The Nginx /upload/ and /del/ blocks ship with commented-out allow / deny lines; enable an IP allowlist, or expose these two paths only on an internal network, before going live (see Nginx).
中文