-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Static website: HTTP auth protection #79
Comments
This gets the job done. Only downide is that Cloudfront functions don't support base64 encoding functions (the Buffer class is not available and Here the user is function handler(event) {
var request = event.request;
var headers = request.headers;
var auth = 'Basic dXNlcjpwYXNzd29yZA==';
if (headers.authorization === undefined || headers.authorization.value !== auth) {
return {
statusCode: 401,
statusDescription: 'Unauthorized',
headers: {
'www-authenticate': { value: 'Basic' }
}
};
}
return request;
} |
@t-richard I was able to achieve it without |
@t-richard How would I be able to integrate this function code within the static-website construct? |
@devsdevsdevs it would be hard to do it for now because Lift does not provide an easy way to do it. Maybe this will allow extensibility #52 The only solution I see is using https://www.serverless.com/framework/docs/providers/aws/guide/resources/#override-aws-cloudformation-resource But this is not ideal as you will need to rewrite the entire Distribution resource because.
|
It would be useful to let protect a static website with some kind of auth system. It would be great to provide staging versions of a website not public available.
Maybe with Cloudfront function could be achieved something like basic authentication with username/password credentials?
Originally posted by @andrea-cristaudo in #5 (comment)
Also reported in #78 by @InvisibleKind
The text was updated successfully, but these errors were encountered: