Reverse proxy almost does everything I want #10319

Open
opened 2025-11-02 09:04:12 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @jhughes2112 on GitHub (Feb 22, 2023).

Feature Description

I'm using oauth2-proxy in front of FusionAuth. Both amazing tools. However, FusionAuth has a field for User and a separate field for Username. User is a GUID, Username is something the user can set. If they don't set a Username, it's null, and thus is not sent when headers are generated. This poses a problem because the way REVERSE_PROXY_AUTHENTICATION_USER works in GItea, if the header that is specified is empty, it pops up the Sign In screen, even though there may be an email present in another header. I really don't want my users to get a GUID for their username by default... only for the slackers who don't bother setting their Username in FusionAuth.

So.... drum roll please. It would be really cool if you could specify fallbacks as comma-separate values, as so:

REVERSE_PROXY_AUTHENTICATION_USER = X-Auth-Request-Preferred-Username,X-Auth-Request-User

In my case, the Username header is sometimes present and is definitely preferable. User is always present, but gross.

Fwiw, I attempted to use the Email header as User, and I got errors because there's an @ sign in it, and that's not legal. Honestly, I would also be pretty happy if it would take email in as a username, or even took the first part up to the @ sign. That'd be even better. All my users are in the same domain, and there's disambiguation code in Gitea already for colliding usernames, so....

By the way, thanks so much for Gitea. I use it, love it, and tell everyone about it.

JH

Screenshots

No response

Originally created by @jhughes2112 on GitHub (Feb 22, 2023). ### Feature Description I'm using oauth2-proxy in front of FusionAuth. Both amazing tools. However, FusionAuth has a field for User and a separate field for Username. User is a GUID, Username is something the user can set. If they don't set a Username, it's null, and thus is not sent when headers are generated. This poses a problem because the way REVERSE_PROXY_AUTHENTICATION_USER works in GItea, if the header that is specified is empty, it pops up the Sign In screen, even though there may be an email present in another header. I really don't want my users to get a GUID for their username by default... only for the slackers who don't bother setting their Username in FusionAuth. So.... drum roll please. It would be really cool if you could specify fallbacks as comma-separate values, as so: ``` REVERSE_PROXY_AUTHENTICATION_USER = X-Auth-Request-Preferred-Username,X-Auth-Request-User ``` In my case, the Username header is sometimes present and is definitely preferable. User is always present, but gross. Fwiw, I attempted to use the Email header as User, and I got errors because there's an @ sign in it, and that's not legal. Honestly, I would also be pretty happy if it would take email in as a username, or even took the first part up to the @ sign. That'd be even better. All my users are in the same domain, and there's disambiguation code in Gitea already for colliding usernames, so.... By the way, thanks so much for Gitea. I use it, love it, and tell everyone about it. JH ### Screenshots _No response_
GiteaMirror added the type/proposaltype/feature labels 2025-11-02 09:04:12 -06:00
Author
Owner

@lunny commented on GitHub (Feb 22, 2023):

Which version is your Gitea instance? I think REVERSE_PROXY_AUTHENTICATION_EMAIL has been supported.

@lunny commented on GitHub (Feb 22, 2023): Which version is your Gitea instance? I think `REVERSE_PROXY_AUTHENTICATION_EMAIL` has been supported.
Author
Owner

@jhughes2112 commented on GitHub (Feb 22, 2023):

I'm on latest. Yes, I can pass the email in, but as I mentioned, if I try to use X-Auth-Email as the username, it fails due to the @ in it.

@jhughes2112 commented on GitHub (Feb 22, 2023): I'm on latest. Yes, I can pass the email in, but as I mentioned, if I try to use X-Auth-Email as the username, it fails due to the @ in it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10319