Modifying the redirect_uri from within a redirect rule

Hi!

We currently have 4 servers that are being served by Auth0 (dev, qa, staging, production). Opening our web address redirects to the Auth0 login page. The redirect URL contains, along with the Auth0 state, the following parameter: redirect_uri. This is the URL the system will redirect to when you successfully log in. Each server sets this parameter, so the login redirects correctly to the relevant server.

All this works fine.

We have now reached a point where we need to create a second (regional) production server (for the US). What we want to be able to do is to have the users log in to the main production server, and based on a metadata field in the user, it will decide which server to redirect to.

To do so, we implemented a redirect rule. The idea was to take the URL we are on now (the Auth0 URL with the Auth0 state), update the redirect_uri in it to the correct server, and redirect to it. This essentially skips the page in the middle (which we don’t need) and will make the login redirect to the correct server.

The problem we’re facing is that we can’t seem to be able to get the current URL. Without access to the current state, we can’t correctly modify it or redirect to it.

Is there a simple way to get it?
Is there some other way to implement the functionality we’re after?

Thanks,

Ilan

Hi!

No answer in 3 days. Anyone know how to resolve our issue?

Thanks,

Ilan