Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple password protection of Framer.js projects pushed to Heroku
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^https://(.*\.)?herokuapp.com [NC]
RewriteCond %{HTTP_REFERER} !^https://(.*\.)?herokuapp.com.*$ [NC]
RewriteRule \.(html|coffee|js)$ - [F]
1. add index.php and .htaccess to Framer project root
2. set password in the index.php file (line 4)
3. push the project to Heroku, it will auto-configure everything and give you the project URL
- the index.php just asks for password and loads index.html if correct
- the .htaccess just makes sure nobody can access directly index.html or app.coffee (or any other html/coffee/js file)
<?php
$pass = $_POST['pass'];
if($pass == "password")
{
include("index.html");
}
else
{
if(isset($_POST))
{?>
<form method="POST" action="index.php">
Password <input type="password" name="pass"></input><br/>
<input type="submit" name="submit" value="Go"></input>
</form>
<?}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment