Skip to content

[expo-image] [android] expo-image doesn't pass regular headers / cookies from the common react-native http stack #43229

@alessbelli

Description

@alessbelli

Minimal reproducible example

https://github.com/alessbelli/test-expo-image-cookies

Steps to reproduce

open the app ( npm run android )

This shows two requests to the same origin (cloudflare-worker code included in the repo).
The /json endpoint is shown in the text element at the bottom of the screen, while the /image.svg is shown at the top of the screen.
Both echo the request headers including the cookies. Both requests set a cookie in the response.

Note that the first request, there are no request cookies (that's expected)
When refreshing the app / opening it anew, note that the native fetch request shows the cookies set the first time around, whereas the expo-image request still shows no cookies.

This is a big problem if images on a given origin require authentication: they will never load.
To a lesser extent, it's very difficult to track usage coming from a specific mobile device since the two requests have a different user-agent.

I expect that by default, requests using expo-image use the same http layer as the base react-native stack that the rest of my app runs on. short of that, I expect to be able to easily swap this out for a predictable http layer.

This works correctly on iOS. requests from expo-image and fetch both come from the same user-agent (Expo/54.0.6 CFNetwork...) and result in requests to either endpoint having the cookies set during both.
android:
Image

ios:

Image

Environment

expo-env-info 2.0.8 environment info:
    System:
      OS: macOS 26.2
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 22.15.1 - ~/.nvm/versions/node/v22.15.1/bin/node
      npm: 10.9.2 - ~/.nvm/versions/node/v22.15.1/bin/npm
    Managers:
      CocoaPods: 1.16.2 - /opt/homebrew/lib/ruby/gems/3.4.0/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 25.1, iOS 26.1, macOS 26.1, tvOS 26.1, visionOS 26.1, watchOS 26.1
    IDEs:
      Android Studio: 2025.2 AI-252.25557.131.2521.14432022
      Xcode: 26.1.1/17B100 - /usr/bin/xcodebuild
    npmPackages:
      expo: ~54.0.33 => 54.0.33
      react: 19.1.0 => 19.1.0
      react-native: 0.81.5 => 0.81.5
    Expo Workflow: managed

Expo Doctor Diagnostics

17/17 checks passed. No issues detected!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions