Skip to content

Allow additional domains in OAuth2 redirect URLs #6483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from

Conversation

PseudoResonance
Copy link
Contributor

Contribution Guidelines

What does this PR include?

Short Description

Currently with OAuth2, you must set a redirect URL that the OAuth provider will redirect users to after authentication.

If you want mailcow to be available on multiple domains (for example a dedicated SOGo subdomain), OAuth2 login will redirect back to the primary domain, leaving the additional domain unusable.

This lets you define additional redirect URLs, and attempts to match them based on your current domain to send to the provider.

Affected Containers

  • nginx
  • php-fpm

Did you run tests?

What did you tested?

Adding/editing identity providers with 0, 1 and 2 additional URLs specified.

Logging in with OAuth2 from 2 domains pointing to mailcow.

What were the final results? (Awaited, got)

I was able to login from both my primary, and webmail domains. The OAuth provider got the correct redirect URL depending on which domain I started on, and redirected me back to the appropriate URL.

@PseudoResonance
Copy link
Contributor Author

PseudoResonance commented Apr 12, 2025

This somewhat goes together with #6482, as my end goal is to have 2 simple URLs for my parents to use, one for SOGo and another for mailcow. They primarily want to use SOGo, but may need to access mailcow occasionally, so I want to have the ease of navigation to SOGo with a single link, without making it harder to access mailcow.

I wasn't totally sure how to implement this without affecting more standard setups though. Hopefully this is acceptable, but of course I'm happy to make any changes if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant