Skip to content

Commit 020ab20

Browse files
committed
fix: remove incorrect parameter reference in simpleurl.js
1 parent 5e99c07 commit 020ab20

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
> * Stripped down to focus on Microsoft Azure __Authentication__ and __Authorization__ only.
1111
> * Webpack config added to bundle the handler and dependencies in to a single file.
1212
> * A __zip__ of the bundled lambda (sans `config.json`) [is released][releases] via a GitHub Action for use in downstream [IaC] projects like [terraform-aws-lambda-edge-azure-auth].
13-
> * Simple-Url handling for default `index.html` and trailing slash redirects.
13+
> * Simple URL (a.k.a [pretty URLs]) handling for default `index.html` and trailing slash redirects ([see below](#simple-urls-and-trailing-slash-redirects)).
1414
> * Downstream terraform module for deployment ([terraform-aws-lambda-edge-azure-auth]).
1515
1616
## Description
@@ -59,6 +59,23 @@ be automatically generated).
5959

6060
[Manual Deployment](https://github.com/Widen/cloudfront-auth/wiki/Manual-Deployment) __*or*__ [AWS SAM Deployment](https://github.com/Widen/cloudfront-auth/wiki/AWS-SAM-Deployment)
6161

62+
## Simple URLs and Trailing Slash Redirects
63+
64+
This lambda function has some options that enable CloudFront to behave similar to to most static
65+
site web servers. When CloudFront is backed by a private __S3__ bucket using an OAI ([Origin
66+
Access Identity]), default `index.html` files are not resolved unless given explicitly in the url
67+
68+
For example, a request for `https://example.com/about/` tries to retrieve an object `about/` in
69+
the bucket, not `about/index.html`)
70+
71+
With the `simple_urls_enabled` option enabled (defaults to `true`):
72+
73+
* `https://example.com/about/` will return the `https://example.com/about/index.html` object
74+
75+
With `trailing_slash_redirects_enabled`:
76+
77+
* `https://example.com/about` will trigger a `301` redirect to `https://example.com/about/`
78+
6279
## Testing
6380

6481
Detailed instructions on testing your function can be found [in the Wiki](https://github.com/Widen/cloudfront-auth/wiki/Debug-&-Test).
@@ -82,6 +99,8 @@ See [CONTRIBUTING.md](Contributing.md).
8299
[node]:https://nodejs.org/en/
83100
[npm]:https://www.npmjs.com/
84101
[oai]:http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html#private-content-creating-oai-console
102+
[origin access identity]:https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html
85103
[openssl]:https://www.openssl.org
104+
[pretty urls]:https://gohugo.io/content-management/urls/#pretty-urls
86105
[terraform-aws-lambda-edge-azure-auth]:https://registry.terraform.io/modules/nickshine/lambda-edge-azure-auth/aws/
87106
[releases]:https://github.com/nickshine/lambda-edge-azure-auth/releases

simpleurl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const redirect = (request, callback) => {
1616

1717
module.exports.handleIndexes = (uri) => {
1818
if (uri.endsWith('/')) {
19-
console.log(`'index.html' appended to request.uri: ${request.uri}`);
19+
console.log(`'index.html' appended to request.uri: ${uri}`);
2020
return `${uri}index.html`;
2121
}
2222

0 commit comments

Comments
 (0)