You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+49Lines changed: 49 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,6 +72,7 @@ the [official documentation for caddy](https://caddyserver.com/docs/build#packag
72
72
## Example Caddyfile
73
73
74
74
### Using file_server
75
+
75
76
```plaintext
76
77
localhost {
77
78
root /your-images-directory
@@ -81,6 +82,7 @@ localhost {
81
82
```
82
83
83
84
### Using reverse_proxy
85
+
84
86
```plaintext
85
87
localhost {
86
88
reverse_proxy your-domain.com
@@ -142,6 +144,53 @@ caddy.
142
144
* Convert an image to AVIF format with lossless compression:
143
145
* http://example.com/image.jpg?fm=avif&ll=true
144
146
147
+
## Advanced Configuration
148
+
149
+
This configuration allows you to control error handling with `on_fail` and `on_security_fail`.
150
+
151
+
You can also manage query parameter processing using `allowed_params` and `disallowed_params`.
152
+
153
+
This gives you fine-grained control over image processing in your Caddy server.
154
+
155
+
156
+
### Example with `on_fail` and Security Configuration
157
+
```plaintext
158
+
localhost {
159
+
image_processor {
160
+
on_fail bypass # Default value
161
+
security {
162
+
on_security_fail ignore # Default value
163
+
164
+
disallowed_params w r ... # These parameters are disallowed in the image processing request. You can also use allowed_params to restrict parameters further.
165
+
# Note: 'allowed_params' and 'disallowed_params' cannot be used together. You must choose one or the other.
166
+
}
167
+
}
168
+
}
169
+
```
170
+
171
+
### Explanation:
172
+
173
+
*`on_fail`:
174
+
*`bypass` (default value): If any error occurs, the original, unprocessed image will be returned.
175
+
*`abort`: If an error occurs, a 500 Internal Server Error response will be returned.
176
+
177
+
178
+
*`on_security_fail`:
179
+
*`ignore` (default value): If any security checks fail, they are ignored, and the image processing continues.
180
+
*`bypass`: If any security checks fail, the original, unprocessed image will be returned.
181
+
*`abort`: If any security checks fail, a 400 Bad Request response will be returned.
182
+
183
+
184
+
***Security Configuration** (`disallowed_params` vs `allowed_params`):
185
+
*`disallowed_params`: Specifies which query parameters are not allowed.
186
+
187
+
For example, parameters like w (width) and r (rotation) can be restricted.
188
+
189
+
*`allowed_params`: Specify which query parameters are allowed. As an alternative to `disallowed_params`.
190
+
191
+
***Important**: You cannot use both allowed_params and disallowed_params in the same configuration.
192
+
193
+
145
194
## Planned Features
146
195
147
196
The following features are planned for future implementation:
0 commit comments