zesty.io

Product

Use Cases

Integrations

Learn

Password Protect Web Engine Preview

Two methods to password protect the preview url for your content instance

Method 1: Hard Lock with Query Parameter

First Method is a hard lock, it requires a query parameter. Edit your loader file and wrap all the code in an if statement like this:

What it does: if the site is now the live url, its check for query parameter pw to equal the set string. For example https://xyz.preview.zestyio.com?pw=test will load the page, but anything else will show a blank screen. This requires every preview url to have the ?pw=test appended to the url.

Method 2: Javascript Prompt with Memory

This method is a soft lock because the page can be accessed with a curl request outside of a normal browser, or with a browser that has javascript disabled.

This method uses javascript to get and set cookies, and to fire off a prompt in your loader file. In your loader you check to see if the website is NOT live. If it is not live then it will lock you out of the page with a javascript prompt before the site loads. It will ask for a password. An incorrect password will redirect you away (line 18), a correct password will store a cookie which will bypass requesting a password as you browse the stage preview site for 30 days.

Start Here

We will listen to your needs and walk you through how Zesty can help your team.

Connect with Content Experts

Book a free 15-minute consultation with a content expert. Discuss your application, pain points and requirements. Understand how Zesty's lower total cost of ownership, features, functionality can elevate your business by creating extraordinary digital experiences.

Trusted By

zesty customer logo Sonyzesty customer logo Rocket Leaguezesty customer logo Singlifezesty customer logo Acornszesty customer logo Phoenix Sunszesty customer logo Wattpadzesty customer logo Corner Shopzesty customer logo Bjs

Enter your details to connect with a Content Expert

First Name

Last Name

Email

Phone (optional)

Company

Please tell us about your project (optional)

G2 MOMENTUM LEADER

zesty customer logo zesty customer logo zesty customer logo zesty customer logo