Skip to content

But: S3 proxy not working when set with ENV #332

@diminDDL

Description

@diminDDL

I have setup Gokapi pretty close to what the docs say. Instead of AWS S3 I am using a self hosted garage S3 instance in another container. These are connected using docker networking, so the compose for Gokapi looks as follows:

services:
  gokapi:
    image: f0rc3/gokapi:latest
    container_name: gokapi
    networks:
      - s3-garage-net
    ports:
      - "53842:53842"
    volumes:
      - ./gokapi-data:/app/data
      - ./gokapi-config:/app/config
    restart: unless-stopped
    env_file:
      - "./.env"

networks:
  s3-garage-net:
    name: s3-garage-net
    external: true

During the setup and creation of .env I selected to enable the S3 proxying, this is confirmed in both files:

# env file
# Timezone
TZ=Europe/Berlin

# Optional S3
GOKAPI_AWS_BUCKET=gokapi-bucket
GOKAPI_AWS_REGION=garage-server-1
GOKAPI_AWS_KEY=redacted
GOKAPI_AWS_KEY_SECRET=redacted
GOKAPI_AWS_ENDPOINT=http://garage:3900
GOKAPI_AWS_PROXY_DOWNLOAD=true

# Other flags
GOKAPI_DISABLE_CORS_CHECK=true
GOKAPI_LOG_STDOUT=false

./gokapi-config/cloudconfig.yml:

aws:
    Bucket: gokapi-bucket
    Region: garage-server-1
    KeyId: redacted
    KeySecret: redacted
    Endpoint: http://garage:3900
    ProxyDownload: true

However, whenever I visit a link and start downloading a file I get redicred to http://garage:3900/gokapi-bucket/... so clearly it is not proxying correctly.

All I see in the logs is

Sat, 15 Nov 2025 11:17:17 UTC   [info] Gokapi started
Sat, 15 Nov 2025 11:17:34 UTC   [upload] test.mp4, ID Q6nqtuUo0CP94Ke, uploaded by admin (user #1)
Sat, 15 Nov 2025 11:17:45 UTC   [download] test.mp4, ID Q6nqtuUo0CP94Ke, Useragent Mozilla/5.0 (X11; Linux x86_64; rv:144.0) Gecko/20100101 Firefox/144.0

And the config json for completeness:

{
  "Authentication": {
    "Method": 0,
    "SaltAdmin": "redacted",
    "SaltFiles": "redacted",
    "Username": "admin",
    "HeaderKey": "",
    "OauthProvider": "",
    "OAuthClientId": "",
    "OAuthClientSecret": "",
    "OauthGroupScope": "",
    "OAuthRecheckInterval": 12,
    "OAuthGroups": [],
    "OnlyRegisteredUsers": false
  },
  "Port": ":53842",
  "ServerUrl": "http://example.com:53842/",
  "RedirectUrl": "https://example.com/",
  "PublicName": "Gokapi",
  "DataDir": "data",
  "DatabaseUrl": "sqlite://./data/gokapi.sqlite",
  "ConfigVersion": 22,
  "MaxFileSizeMB": 102400,
  "MaxMemory": 50,
  "ChunkSize": 45,
  "MaxParallelUploads": 3,
  "Encryption": {
    "Level": 0,
    "Cipher": null,
    "Salt": "",
    "Checksum": "",
    "ChecksumSalt": ""
  },
  "UseSsl": false,
  "PicturesAlwaysLocal": false,
  "SaveIp": false,
  "IncludeFilename": false
}

Just to be clear, uploading works perfectly and I can see the data appearing in the S3 bucket, so it can communicate with the endpoint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions