Deploying a Receipt Management System for quickdumpnow.com: S3, CloudFront, and Custom Error Handling
This post covers the deployment of a receipt management interface for a trailer rental business at https://quickdumpnow.com/books, including S3 object management, CloudFront cache invalidation strategies, and debugging 404 redirect behavior in CDN configurations.
Project Context
The quickdumpnow.com site needed a dedicated receipts page to support the trailer rental business operations. The page existed locally but had never been deployed to production. Additionally, concurrent work was underway to migrate port sheet data for a sailing charter operation into a structured Google Apps Script project, which we'll touch on briefly.
What Was Done
- Created and deployed a receipt management page to
https://quickdumpnow.com/books - Updated
robots.txtto block the /books path from search engine crawling - Diagnosed and resolved CloudFront 404 redirect behavior caused by custom error response configuration
- Implemented proper S3 object structure to support pretty URLs without file extensions
- Initiated CloudFront cache invalidation for both the new path and root directory
Technical Details: S3 Object Structure and Pretty URLs
A common pattern in static site hosting is serving HTML pages without requiring the .html extension in the URL. To achieve this with S3 and CloudFront, we needed to understand how S3 serves objects and how to configure the bucket appropriately.
The site structure locally was:
/Users/cb/Documents/repos/sites/quickdumpnow.com/
├── books/
│ └── index.html
├── robots.txt
└── [other site files]
When uploading to S3, we deployed the page using two S3 keys to support the pretty URL pattern:
s3://quickdumpnow-web/books/index.html— the canonical object containing the HTMLs3://quickdumpnow-web/books/— an empty object serving as a directory marker for direct access
This dual-key approach allows CloudFront to serve the content whether the request comes in as /books or /books/, accommodating browser behavior and SEO best practices.
robots.txt Configuration and Search Engine Blocking
The updated robots.txt file includes:
User-agent: *
Disallow: /books/
This prevents search engines from indexing the receipts page. The decision to block this path was driven by business requirements—the page contains sensitive financial data specific to a single business operation and should not be discoverable via search.
Infrastructure: CloudFront Cache Invalidation and Error Handling
After uploading objects to S3, we needed to invalidate the CloudFront distribution cache to ensure users received the new content immediately rather than stale cached responses. CloudFront distributions can be identified by their Distribution ID (a string like E1ABC2DEFGH3IJ).
Invalidation patterns used:
aws cloudfront create-invalidation \
--distribution-id E1ABC2DEFGH3IJ \
--paths "/books" "/books/*" "/"
The invalidation paths were:
/books— direct path without trailing slash/books/*— wildcard to catch all content under /books//— root, invalidated to clear any cached homepage references
Invalidations typically complete within 30–60 seconds, though CloudFront will show them as "InProgress" during that window.
Debugging: Custom Error Response Redirect Behavior
Initial testing showed that https://quickdumpnow.com/books returned the homepage instead of a 404 or the receipt page. This indicated a CloudFront custom error response was configured to redirect all 404 errors to the root path.
To diagnose this, we checked the CloudFront distribution configuration:
aws cloudfront get-distribution-config --id E1ABC2DEFGH3IJ
The relevant section in the distribution config showed:
<ErrorResponse>
<ErrorCode>404</ErrorCode>
<ResponsePagePath>/</ResponsePagePath>
<ResponseCode>200</ResponseCode>
<DefaultTTL>300</DefaultTTL></ErrorResponse>
This configuration told CloudFront: "If an object returns 404, respond with the root path (/) instead, and serve it with HTTP 200." This is useful for single-page applications where all routes should load the app shell, but it masked the real problem—our S3 objects didn't exist yet.
Once the S3 objects were uploaded, CloudFront would find them and serve them directly, bypassing the error response rule.
Key Decisions and Rationale
Why block /books in robots.txt? Financial data belongs behind authentication or obscurity. Blocking search engines adds a layer of privacy-by-configuration, reducing the surface area for accidental exposure.
Why deploy both /books and /books/index.html? S3 doesn't have true directories—all objects are flat keys. By uploading both variants, we accommodate various client behaviors (some may add trailing slashes, some may not). CloudFront's origin behavior and S3's lack of automatic directory indexing meant we needed explicit objects for both paths.
Why invalidate multiple paths? CloudFront caches at the path level. Invalidating /, /books, and /books/* ensures that any cached references to the homepage or /books paths are purged, forcing fresh requests to origin.
Concurrent Work: Port Sheet Data Migration
In parallel, we began migrating port sheet data for a sailing charter operation into a Google Apps Script project (PortSheetReporter.gs). This involved:
- Reading the structure of existing port log spreadsheets
- Creating an April tab in the port log with proper formatting
- Appending charter entries (e.g., Joseph Zurek charter, $1,845.72 revenue)
- Using the Google Sheets API to identify correct sheet IDs and write data programmatically
This work was separate from the quickdumpnow deployment but used similar principles: identifying the correct resource identifiers (sheetId vs. tabId), handling authentication, and ensuring data consistency.
What's Next
- Implement authentication and authorization for the /books page to restrict access to business staff only
- Build a form interface to accept receipt uploads and store them durably (e.g., S3, DynamoDB for metadata)
- Monitor CloudFront cache hit ratio to optimize TTLs and invalidation strategy
- Complete the port sheet data migration and establish a repeatable process for charter entry logging
- Set up automated reporting or email notifications when new receipts are submitted
Key Takeaway
Static