apply custom rules #3
-
hi i want to call the proxy with custom rules ( not defined into imgproxy.conf ) for example i have this /@s3img/_small/KEY.jpp where @s3img is the s3 source, and _small is the presset /unsafe/size:640:0:0:0/plain/s3://BUCKETNAME/KEY.jpg@webp ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You need to add your S3 bucket in the map $uri $origin_server
{
default 'local://';
# your desired path @s3img and the bucket will be here
~^/@s3img/ 's3://BUCKETNAME';
} Then in the services:
imgproxy:
environment:
### External source (S3)
### See: https://docs.imgproxy.net/serving_files_from_s3
IMGPROXY_USE_S3: "true"
IMGPROXY_S3_REGION: "us-east-2"
IMGPROXY_S3_ENDPOINT: "<your endpoint>"
AWS_ACCESS_KEY_ID: "<your id>"
AWS_SECRET_ACCESS_KEY: "<your key>" Then start the docker after updating the above settings by running: docker compose up Now you can access your image with custom filter on browser by opening:
If you want to add your own imgproxy settings, please add extra rules inside the For example, I want to add a ## **`$preset_name`**
## Parse preset name from requested URI.
map $uri_omitted_origin $preset_name
{
default '';
# set the preset name to "max640" when the URI starts with max640
~^/max640/ 'max640';
}
## **`$imgproxy_preset`**
## Define `imgproxy` options for each preset name.
map $preset_name $imgproxy_preset
{
default 'size:1600:0:0:0/preset:logo';
# define custom imgproxy congfig for the preset named "max640"
max640 'size:640:0:0:0';
} After restart your docker container, you can access your image with the new filter on browser by opening:
|
Beta Was this translation helpful? Give feedback.
@boardmain
You need to add your S3 bucket in the
$origin_server
block ofimgproxy.conf
:Then in the
docker-compose.yml
, please uncomment S3 setting lines withinenvironment
key:Then start the docker after updati…