Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storage: header if-modified-since being ignored #267

Open
ffabss opened this issue Mar 29, 2022 · 2 comments
Open

Storage: header if-modified-since being ignored #267

ffabss opened this issue Mar 29, 2022 · 2 comments
Labels
enhancement New feature or request file-adapter

Comments

@ffabss
Copy link

ffabss commented Mar 29, 2022

Bug report

Describe the bug

It seems that either the storage API is ignoring the if-modified-since header or the Cloudflare cache is ignoring it, as I seem to always get the file even though it has not been modified.

To Reproduce

  1. Go to Supabase Dashboard > Storage
  2. Create new bucket or use existing
  3. Upload any file
  4. Make following request:
curl http://<YOUR_PROJECT>.supabase.co/storage/v1/object/authenticated/images/image.png \
-H "if-modified-since: <DATE_AFTER_LAST_MODIFICATION>" \
-H "Authorization: Bearer <ALLOWED_API_TOKEN>" \
-I

("-I" to show document info only)

Expected behavior

The file should not be returned as it has not been modified and the http-status-code should be 304.

Actual

The file is returned and the status-code is 200.

curl https://<YOUR_PROJECT>.supabase.co/storage/v1/object/authenticated/images/image.png \
> -H "if-modified-since: Tue Mar 25 2022 19:08:51 GMT+0000 (Coordinated Universal Time)" \
> -H "Authorization: Bearer <ALLOWED_API_TOKEN>" \
> -I
HTTP/2 200
date: Tue, 29 Mar 2022 15:09:46 GMT
content-type: image/png
content-length: 1355
cf-ray: 6f39874e3a7b787f-VIE
accept-ranges: bytes
access-control-allow-origin: *
age: 570
cache-control: max-age=3600
etag: "ee35207bece5c11122eeb500b19ffa70"
last-modified: Tue Mar 15 2022 19:08:51 GMT+0000 (Coordinated Universal Time)
vary: Origin, Accept-Encoding
via: kong/2.2.1
cf-cache-status: HIT
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
ratelimit-limit: 100
ratelimit-remaining: 99
ratelimit-reset: 1
x-kong-proxy-latency: 2
x-kong-upstream-latency: 177
x-ratelimit-limit-second: 100
x-ratelimit-remaining-second: 99
server: cloudflare
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400

Additional context

I was unable to find out what version of the storage API is running on my hosted instance, so I couldn't add that information. If you can tell me where to find this information, I can include it.

@ffabss ffabss added the bug Something isn't working label Mar 29, 2022
@foysalit
Copy link

Looks like this PR #66 should have fixed it. If you could add some insight, I would attempt to patch further issues @thebengeu @inian

@ffabss
Copy link
Author

ffabss commented May 24, 2022

I believe that the PR you linked only provided the solution for the S3 backend. Maybe the free/hosted version of Supabase does not use this backend and the used backend does not support this functionality.
The only thing I can say for certain is that the problem still exists.

@sweatybridge sweatybridge transferred this issue from supabase/supabase Jan 20, 2023
@fenos fenos added file-adapter enhancement New feature or request and removed bug Something isn't working labels Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request file-adapter
Projects
Status: No status
Development

No branches or pull requests

4 participants
@foysalit @fenos @ffabss and others