amplify-hosting icon indicating copy to clipboard operation
amplify-hosting copied to clipboard

Turn on password for PR previews

Open afern247 opened this issue 2 years ago • 5 comments

I have turn on the password on amplify hosting for my dev environment/url, but when a new PR gets created that PR doesn't have a password and I can't apply it globally because then prod would also be protected with password, how can I restrict the access for PRs as well?

image

afern247 avatar Sep 07 '23 10:09 afern247

Hi @afern247 Transferring to Amplify Hosting repo for them to take a look.

hbuchel avatar Sep 07 '23 13:09 hbuchel

Hi @afern247 👋 , thanks for raising this!

You can enable access control or password protection on a per branch level by turning off the option to apply a global password.

To apply a username and password to an individual branch, turn off Apply a global password. For the branch that you want to set a unique username and password for, choose Restricted-password required for Access setting and enter a username and password.

Documentation: https://docs.aws.amazon.com/amplify/latest/userguide/access-control.html

Jay2113 avatar Sep 07 '23 16:09 Jay2113

Hi @Jay2113 , please check my question again above:

I can't apply it globally because then prod would also be protected with password, how can I restrict the access for PRs as well?

This is for Amplify Hosting preview on feature branches. Is there a way to apply globally and override only 1 (the main prod branch), if not what do you recommend in this case?

afern247 avatar Sep 07 '23 21:09 afern247

Hi @afern247

Your question probably relates to the following feature request. [Feature request] Support default password protection for all new branches #280

There is no direct feature as you are asking for, but you can solve it in the following ways.

currently there isn't an easy way to do so. A workaround would be to have 2 Amplify Console apps connected to the same repo - first app is your production app. 2nd app has all your other branches and you can set a global password for all the connected branches. https://github.com/aws-amplify/amplify-hosting/issues/280#issuecomment-561871146

tobigumo avatar Sep 20 '23 08:09 tobigumo

That's not scalable, that involves maintaining 2 separate entities with the same level of architecture.

I'm looking for a solution for 1 app only.

afern247 avatar Sep 26 '23 22:09 afern247