ionic-team / ionic-team/capacitor

[Bug]: CapacitorHttp: Authorization header not forwarded on 302 redirect (iOS only)

Open
#8,116 1 comment 0 reactions 0 assignees View on GitHub
triage
Dominant language
TypeScript
Stars
16.7k
Forks
1.3k
Avg merge
3d 15h
Merged PRs (30d)
10

Description

### Capacitor Version

Latest Dependencies:

@capacitor/cli: 7.4.3
@capacitor/core: 7.4.3
@capacitor/android: 7.4.3
@capacitor/ios: 7.4.3

Installed Dependencies:

@capacitor/cli: 7.4.3
@capacitor/ios: 7.4.3
@capacitor/core: 7.4.3
@capacitor/android: 7.4.3

### Other API Details

```Shell
npm --version output: 11.4.2
node --version output: v24.3.0
pod --version output: 1.16.2
```

### Platforms Affected

- [x] iOS
- [ ] Android
- [ ] Web

### Current Behavior

When using the CapacitorHttp plugin, Authorization header is not included in the redirected request on iOS. On Android, and when running as a web app on iOS/mac, the header is forwarded as expected. It also works when CapacitorHttp is disabled. This issue appears to affect only POST requests with 302 redirects.

### Expected Behavior

Authorization header from the POST request should be included in the redirect request.

### Project Reproduction

https://github.com/ruifang/capacitor-http-troubleshoot

### Additional Information

Http request used in example:
```
POST /redirect-to?url=headers HTTP/1.1
Host: httpbingo.org
Authorization: Bearer 1234
X-Custom-Header: 123456
```

iOS:
https://github.com/user-attachments/assets/bf413401-c37b-4005-88d9-dae325103725
Safari:
https://github.com/user-attachments/assets/7b0e57c7-7811-4886-958d-d5314271ea23
Android:
https://github.com/user-attachments/assets/653e63f7-34a8-44fa-b0ba-47a2c3fb224e

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.