[SOLVED] REST API upload - 405 Method Not Allowed
gander opened this issue · comments
Adam Gąsowski commented
Thumbor request URL
http://localhost:8888/
Expected behaviour
Upload Image via API with success status 201
Actual behaviour
curl -i -H "Content-Type: image/jpeg" -H "Slug: photo.jpg" -XPOST http://localhost:8888/image --data-binary "@test.jpg"
HTTP/1.1 405 Method Not Allowed
Server: TornadoServer/6.3.3
Content-Type: text/html; charset=UTF-8
Date: Fri, 19 Jan 2024 15:01:38 GMT
Content-Length: 87
Operating system
Software | Version |
---|---|
Linux Mint | v21.3 |
Docker | v24.0.7 |
Thumbor | v7.7.1 |
Your docker-compose.yaml
version: '3'
services:
thumbor:
image: ghcr.io/minimalcompact/thumbor:latest
volumes:
- ./thumbor.conf:/etc/thumbor.conf
ports:
- 8888:80
Your thumbor.conf
#################################### Upload ####################################
## Max size in bytes for images uploaded to thumbor
## Aliases: MAX_SIZE
## Defaults to: 0
#UPLOAD_MAX_SIZE = 0
## Indicates whether thumbor should enable File uploads
## Aliases: ENABLE_ORIGINAL_PHOTO_UPLOAD
## Defaults to: False
UPLOAD_ENABLED = True
## The type of storage to store uploaded images with
## Aliases: ORIGINAL_PHOTO_STORAGE
## Defaults to: 'thumbor.storages.file_storage'
UPLOAD_PHOTO_STORAGE = 'thumbor.storages.file_storage'
## Indicates whether image deletion should be allowed
## Aliases: ALLOW_ORIGINAL_PHOTO_DELETION
## Defaults to: False
UPLOAD_DELETE_ALLOWED = True
## Indicates whether image overwrite should be allowed
## Aliases: ALLOW_ORIGINAL_PHOTO_PUTTING
## Defaults to: False
UPLOAD_PUT_ALLOWED = True
## Default filename for image uploaded
## Defaults to: 'image'
UPLOAD_DEFAULT_FILENAME = 'image'
################################################################################
Adam Gąsowski commented
The documentation is imprecise. In fact, it doesn't say anywhere where to put the configuration file when this is run in a Docker container. I had no reason to assume that the configuration for Docker would be predetermined and not follow the documentation.
I found the answer in docker-entrypoint.sh code:
The configuration file should be located in /app/thumbor.conf
version: '3'
services:
thumbor:
image: ghcr.io/minimalcompact/thumbor:latest
volumes:
- ./thumbor.conf:/app/thumbor.conf
ports:
- 8888:80