1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-12-09 09:56:01 +02:00
Commit Graph

58 Commits

Author SHA1 Message Date
Ewan Higgs
4944dfab30
Support Last-Modified response header and support If-Modified-Since request header. (#1147)
* Always return Last-Modified and support If-Modified-Since.

* IMGPROXY_USE_LAST_MODIFIED config setting.

IMGPROXY_USE_LAST_MODIFIED  (default false) when enabled will return the
Last-Modified time of the upstream image and also allow the support of
the If-Modified-Since request header (returning a 304 if the image
hasn't been modified).

If-Modified-Since allows If-None-Match to take precedence.

* Fixes based on DarthSim's feedback.

1. Don't worry about nil maps.
2. Fix a test now that we use the config.LastModifiedEnabled (and move
   it's location it he test file to a more sane place).
3. Update GCS transport code based on the refactoring of DarthSim.

In this iteration, we pull the Updated time from the GCS object attributes
and format them as a string. We then parse it in the notmodified module.
Seems a bit silly to do it this way. If we agree on the approach here,
then AWS and Azure can follow.

* Support azure, fs, s3, and swift.

* Grab the headers for If-Modified-Since and Last-Modified before parsing them.

* Add tests for last-modified for fs.

* Support Last-Modified being passed when streaming an upstream file.

* Tests for Last-Modified for GCS and Azure

* Support s3 and swift tests. Sadly fakes3 doesn't support Last-Modified

* Test against forked gofakes3
2023-05-03 21:21:46 +06:00
DarthSim
c98752651a Don't set Content-DPR header 2023-04-18 18:40:23 +03:00
DarthSim
b92de43cf3 Add support for client hints prefixed with Sec-CH-; Remove Viewport-Width header support 2023-04-11 21:08:39 +03:00
DarthSim
1a9768a2c6 Prohibit connecting to loopback, link-local multicast, and link-local unicast IP addresses by default 2023-03-22 20:25:51 +03:00
DarthSim
24f4d43a0f use "clean" HTTP transport; Use context for downloading timeout control 2023-03-21 20:58:16 +03:00
DarthSim
51aa219315 Add Accept to the Vary header if AVIF detection is enabled 2023-03-09 18:08:08 +03:00
DarthSim
50d04d585e Make the expires option set Expires and Cache-Control headers 2023-02-24 19:44:03 +03:00
DarthSim
aa80dc022f Move download options to imagedata.DownloadOptions 2023-02-23 21:39:52 +03:00
DarthSim
9416168575 Security processing options 2023-02-23 21:11:44 +03:00
DarthSim
bbb6a3335d Remove all known unsafe attrs from SVG during sanitization; Add Content-Security-Policy header to response 2023-01-11 18:32:21 +03:00
DarthSim
4ab415fd9b Fix feDropShadow SVG filter when IMGPROXY_SVG_FIX_UNSUPPORTED is true 2022-10-15 20:22:54 +06:00
DarthSim
f5f4fb6487 Borrow buffer from imagedata pool when sanitizing SVG 2022-10-15 19:31:04 +06:00
DarthSim
0dc16ba76b Fix path before signature check 2022-09-15 22:36:47 +06:00
DarthSim
30f744e116 Try to fix path if signature is invalid 2022-09-15 22:12:16 +06:00
DarthSim
0f7281e56e raw processing option 2022-09-07 18:03:12 +06:00
DarthSim
cf2b3c5195 requests/images in progress stats and queue time metric 2022-07-26 14:35:49 +06:00
DarthSim
9081fd5766 IMGPROXY_REQUESTS_QUEUE_SIZE config 2022-07-20 19:46:21 +06:00
DarthSim
526724105e Proper semaphore 2022-07-20 18:06:26 +06:00
DarthSim
20039f49a5 Better error metrics 2022-07-20 16:09:07 +06:00
DarthSim
e1e2277a32 Sanitize SVG 2022-06-10 18:23:55 +06:00
Valentine Kiselev
23d0807e46
Add attachment option for Content-Disposition header (#887)
* Add attachment option for Content-Disposition header

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>

* Add documentation to attachment option

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>

* Add default attachment option value

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>

* fix: Add default value to docs

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>

* fix: Rename option attachment to return_attachment, add ENV-configuration

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>
2022-06-06 14:53:09 +06:00
DarthSim
91a3671f9d Add X-Result-Width and X-Result-Height to debug headers 2022-04-18 16:45:34 +06:00
dcanob
f37d027f4f
add config fallback ttl to avoid default ttl when fallback response (#818)
* add config fallback ttl to avoid default ttl when fallback response

* Update docs/configuration.md

Co-authored-by: Sergey Alexandrovich <DarthSim@users.noreply.github.com>

* move FallbackTTL to loadFallbackImage

* rewrite ifelse

* Update imagedata/image_data.go

don't use config.FallbackTTL on header to get TTL on the response

Co-authored-by: Sergey Alexandrovich <DarthSim@users.noreply.github.com>

* Update processing_handler.go

don't use config.FallbackTTL on header to get TTL on the response

Co-authored-by: Sergey Alexandrovich <DarthSim@users.noreply.github.com>

* rename FallbackTTL to FallbackImageTTL

* Update processing_handler.go

* Fix linter errors

Co-authored-by: Sergey Alexandrovich <DarthSim@users.noreply.github.com>
2022-03-31 13:36:13 +06:00
DarthSim
b5863c808b Move metrics.StartRequest to middleware && Fix Datadog 2022-01-14 00:40:14 +06:00
DarthSim
e43c24c544 Start requiest timer in router 2022-01-14 00:18:48 +06:00
DarthSim
d8bedfd930 Polish cookies passthrough 2021-11-11 15:30:32 +06:00
Walter Doerwald
abbfb61ce6 Add option to pass through incoming cookies in the image request. 2021-11-09 12:14:05 +01:00
DarthSim
d8dae48c4f Report downloading errors only when IMGPROXY_REPORT_DOWNLOADING_ERRORS is true 2021-11-01 20:03:19 +06:00
DarthSim
b98919ead4 Better downloading error reporting cause 2021-11-01 18:29:26 +06:00
DarthSim
ac8c34a49a Respond with 500 for "temporary" downloading errors 2021-11-01 18:13:33 +06:00
DarthSim
80331cd94e Add cache control headers to 304 response 2021-10-13 17:59:46 +06:00
DarthSim
38ca14230d Add origin width & height to debug headers 2021-10-12 16:56:04 +06:00
DarthSim
da10f3eac3 Fix Client Hints behavior 2021-10-12 16:56:03 +06:00
DarthSim
7709b74a5e Bump version 2021-09-30 20:23:30 +06:00
DarthSim
57c314b1f5 Etag passthough 2021-09-29 16:23:54 +06:00
DarthSim
4434f40701 Merge branch 'version/3' into version/3-refactoring 2021-06-28 16:11:33 +06:00
DarthSim
ece4310d70 Merge branch 'master' into version/3 2021-06-28 15:54:02 +06:00
DarthSim
56858a3692 More clear downloading timeout errors; Add image URL to fallback image usage warning 2021-06-28 14:37:25 +06:00
DarthSim
2ea1466d96 Global refactoring 2021-05-07 17:10:21 +06:00
DarthSim
1df1a9eaa8 Fix debug header 2021-04-05 19:47:29 +06:00
Svyatoslav Kryukov
88975f3810 Datadog tracing 2021-03-23 17:08:02 +06:00
Svyatoslav Kryukov
5ba463749c Refactor tracing 2021-03-23 17:08:02 +06:00
Svyatoslav Kryukov
c07222b501
Skip processing option (#590)
* Skip processing option

* Simplify SkipProcessingFormats iteration
2021-03-22 20:16:03 +06:00
Svyatoslav Kryukov
b93aa2f144
Fallback image http code config (#589) 2021-03-19 15:28:23 +06:00
DarthSim
27dbed077f DRY image downloading 2021-03-17 19:29:58 +06:00
DarthSim
baf00f64f2 Drop deprecated stuff (MaxSrcDimension, GZipCompression, IMGPROXY_MAX_GIF_FRAMES, resizeCrop) 2021-03-15 16:47:35 +06:00
snowcall
56d3f6d897
Optionally return rel="canonical" header (#542)
* set rel="canonical" header

* check scheme before setting canonical headers, add documentation
2021-03-09 17:08:22 +06:00
Huy Le Viet
a62b22af69
Add IMGPROXY_ENABLE_DEBUG_HEADERS config for debugging infomation (#509) 2020-11-20 10:52:16 +06:00
DarthSim
5c4860c609 Update NewRelic 2020-11-18 21:59:44 +06:00
DarthSim
3b83fb04b2 Drop cancelled requests in queue 2020-10-08 17:56:39 +06:00