[PR #2895] [MERGED] fix: oauth proxy between http and https #21448

Closed
opened 2026-04-15 20:22:43 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/2895
Author: @juliusmarminge
Created: 6/3/2025
Status: Merged
Merged: 6/10/2025
Merged by: @Bekacru

Base: mainHead: patch-2


📝 Commits (5)

📊 Changes

6 files changed (+48 additions, -4 deletions)

View changed files

📝 docs/content/docs/plugins/oauth-proxy.mdx (+4 -1)
📝 packages/better-auth/src/plugins/oauth-proxy/index.ts (+28 -1)
📝 packages/better-auth/src/plugins/oauth-proxy/oauth-proxy.test.ts (+1 -1)
📝 packages/expo/src/client.ts (+1 -0)
📝 packages/expo/src/expo.test.ts (+10 -1)
📝 packages/expo/src/index.ts (+4 -0)

📄 Description

Shows a POC of an issue with the oauth proxy. We're setting secure headers, even if the proxied url is a localhost without ssl:

CleanShot 2025-06-03 at 22 28 05@2x

This is hacky, probably a much nicer solution exists and thus the PR should not be merged as is, as it won't cover custom cookie names etc. The isSecureContext check might also not be the best, but this is what I did to make it work. Happy to continue with guidance on proper helpers etc to use as well as adding tests


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/2895 **Author:** [@juliusmarminge](https://github.com/juliusmarminge) **Created:** 6/3/2025 **Status:** ✅ Merged **Merged:** 6/10/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `patch-2` --- ### 📝 Commits (5) - [`77d0d11`](https://github.com/better-auth/better-auth/commit/77d0d11e90bec861f372edd89f774c15e9dd8873) Update index.ts - [`edd445e`](https://github.com/better-auth/better-auth/commit/edd445ee6d44dee227cb94afa87c108f7f02d814) support prefix - [`3e699fc`](https://github.com/better-auth/better-auth/commit/3e699fc2547974433c37316c38167c6c0bbfdae2) chore: revert test - [`5d1960c`](https://github.com/better-auth/better-auth/commit/5d1960c93393eb26d4a31c9c1a8bdfe1d5bf8acb) skip oauth proxy header - [`a45492f`](https://github.com/better-auth/better-auth/commit/a45492fa0c43546dbc0aeef634211a4f41dcf5da) add test ### 📊 Changes **6 files changed** (+48 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/oauth-proxy.mdx` (+4 -1) 📝 `packages/better-auth/src/plugins/oauth-proxy/index.ts` (+28 -1) 📝 `packages/better-auth/src/plugins/oauth-proxy/oauth-proxy.test.ts` (+1 -1) 📝 `packages/expo/src/client.ts` (+1 -0) 📝 `packages/expo/src/expo.test.ts` (+10 -1) 📝 `packages/expo/src/index.ts` (+4 -0) </details> ### 📄 Description Shows a POC of an issue with the oauth proxy. We're setting secure headers, even if the proxied url is a localhost without ssl: ![CleanShot 2025-06-03 at 22 28 05@2x](https://github.com/user-attachments/assets/a17094fd-68db-4735-ab6e-78b624f91689) This is hacky, probably a much nicer solution exists and thus the PR should not be merged as is, as it won't cover custom cookie names etc. The `isSecureContext` check might also not be the best, but this is what I did to make it work. Happy to continue with guidance on proper helpers etc to use as well as adding tests --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-15 20:22:43 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#21448