Skip to content

Commit

Permalink
feat: introduce default robots.txt files (#4329)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j authored Oct 10, 2024
1 parent 04061f0 commit 9ce5e75
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apps/admin/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# No robots allowed.
User-agent: *
Disallow: /
1 change: 1 addition & 0 deletions apps/website/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# All robots allowed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# No robots allowed.
User-agent: *
Disallow: /
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# All robots allowed.
17 changes: 17 additions & 0 deletions packages/pulumi-aws/src/apps/website/createWebsitePulumiApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,23 @@ export const createWebsitePulumiApp = (projectAppParams: CreateWebsitePulumiAppP
minTtl: 0,
defaultTtl: 2592000, // 30 days
maxTtl: 2592000
},
// This forward is necessary for non-WCP projects. For WCP projects, the
// forwarding is performed by the `website-router` Lambda@Edge function.
{
compress: true,
allowedMethods: ["GET", "HEAD", "OPTIONS"],
cachedMethods: ["GET", "HEAD", "OPTIONS"],
forwardedValues: {
cookies: {
forward: "none"
},
headers: [],
queryString: false
},
pathPattern: "/robots.txt",
viewerProtocolPolicy: "allow-all",
targetOriginId: appBucket.origin.originId
}
],
customErrorResponses: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ export const uploadAppToS3 = ({ folder, ...config }: UploadAppToS3Config) => ({
pattern: /index\.html/,
value: "no-cache, no-store, must-revalidate"
},
{
pattern: /robots\.txt/,
value: "no-cache, no-store, must-revalidate"
},
{
pattern: /.*/,
value: "max-age=31536000"
Expand Down

0 comments on commit 9ce5e75

Please sign in to comment.