Skip to content

Cache control not applied when uploading files #550

@florian-mlr

Description

@florian-mlr

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

I have noticed an issue regarding the "Cache-Control" header. After uploading an image and explicitly specifying the "cacheControl" option, I find that when I subsequently retrieve the image, the header does not include the intended "Cache-Control" configuration. Instead, it appears that the cache control is set to "no-cache."

try await NetworkClient.shared.storage
            .from("photos")
            .upload(
                path: "\(userId)/\(photoName).\(fileExtension)",
                file: data,
                options: FileOptions(
                    cacheControl: "172800",
                    contentType: "image/jpeg"
                )
            )

To Reproduce

Upload an image and set the cache control
When fetching the uploaded image, the header contains "Cache-Control: no-cache"

Expected behavior

When fetching the uploaded image, the header should contains "Cache-Control: max-age=172800"

System information

  • OS: iOS 17.4
  • Version of supabase-swift: 2.8.1

Additional context

I also want to mention that I tried updating the library to v2.20.0 to check if the issue is resolved. However, when I proceeded with the update, I encountered an error: "error: errSecItemNotFound: The item cannot be found." Due to this error, I decided to abandon the migration.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions