Authentication for staging websites


We have a staging server with many client projects on it. Every project is installed on a subdomain and is currently protected with htaccess basic auth.

Our goal is to create a entry site ( where a client will enter a unique code (numerics, symbols and letters). This site will only be available in our country. In the background that code is stored and will redirect to a specific subdomain. That subdomain should only be available, if a user entered a valid code before. The user must not reauthenticate within 72 hours. Sometimes a project has more than one subdomain. Authentication must only be necessary once. Once a user authenticated, he can only read that website (fyi).

Does anyone have tips, ideas or best practices, how Cloudflare services could support us with that?

Thank you very much for your responses!

This part is going to need to be something that you develop. You could look into Cloudflare Workers for the backend for this.

Depending on the number of clients you have that will be accessing the system you could look into Cloudflare’s Zero Trust but it will not the do the redirect process.


Modify your requirements and use Access or write your own auth platform.

sometimes the solution is very near :wink:

Actually access should work, from what I‘ve seen so far. Thank you.

We can set a access rule for every subdomain and use customers emails and domains for one time pin. our project partners may be onboarded as guests on m365 and can benefit from more convenient login with their m365 account.


1 Like