Kuri
Kuri

Reputation: 25

Unexpected Duplicate Recordings in DynamoDB for URL Shortening Service Accesses via Chrome

I've created a URL shortening service that tracks the number of clicks on shortened URLs by recording the access time in DynamoDB (formatted as "2024-04-02 12:12:54.123456").

However, I'm encountering an issue where accessing the shortened URL (e.g., shorturl.com/abc123) through Chrome sometimes registers two records for a single redirect after the third click.

For example, after three successful accesses, the fourth attempt unexpectedly increments the count by two. Of course, it continues to increase by two each time thereafter.

dynamoDB items-> enter image description here

Interestingly, this issue doesn't occur when the Chrome Developer Tools network panel is open, or when using Firefox or Edge browsers, where each redirect consistently counts as a single access.

The CloudFront redirect behavior is set to 'Managed-CachingDisabled', and the API Gateway response is configured with a 302 HTTP method. What could be causing this discrepancy?

enter image description here

Upvotes: 0

Views: 19

Answers (0)

Related Questions