Skip to content

Commit

Permalink
Add headers logging for debugging. (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
EarthlingDavey authored Dec 6, 2024
1 parent c535c67 commit e99f4db
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 6 additions & 3 deletions conf/node/controllers/cloudfront.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,12 @@ export const getCookies = ({ resource, dateLessThan, ipAddress }) => {
DateLessThan: {
"AWS:EpochTime": dateLessThan, // time in seconds
},
IpAddress: {
"AWS:SourceIp": ipAddress,
},
...(ipAddress?.length && {
// Optional, only if the IP address is provided
IpAddress: {
"AWS:SourceIp": `${ipAddress}/32`,
},
}),
},
},
],
Expand Down
4 changes: 4 additions & 0 deletions conf/node/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ app.get("/access-archive", async function (req, res, next) {
try {
const clientIp = req.headers["x-forwarded-for"]?.split(',')[0].trim();

console.log('headers', req.headers);

console.log('clientIp', clientIp);

// Get the current domain from the request
const appUrl = new URL(
`${req.headers["x-forwarded-proto"] || req.protocol}://${
Expand Down

0 comments on commit e99f4db

Please sign in to comment.