Email links in Gmail make two requests

Viewed 605

I've encountered a weird situation, after registration we're sending an email with a verification link, pretty standard stuff, but somehow clicking on the link seems to make the request twice, looking at the logs, the first time it comes from my IP and the second request comes from some Google IP: 66.102.8.60 (doing a reverse lookup shows google-proxy-66-102-8-60.google.com).

Any idea what's going on and how to prevent this?

The server is running Nginx and the site is Ruby on Rails if that helps.

1 Answers

I do not know the root cause but my best guess is same as Tripleee wrote above - most probably google is scanning urls. This happens in all browsers (well at least in Chrome and Firefox), but only under following circumstances:

  • the url is clicked from gmail (if you copy paste it to browser tab, the second request is not issued)
  • the url is clicked for the first time... Subsequent clicks from the same email do not trigger second request

I know it is probably not the answer you expected, but after giving it some thought I figured that operation like this should be handled on server side. In my case I am tracking information about confirmation urls anyways, so the first time the request comes to my backend I am deleting it and proceeding with confirmation normally. Since the confirmation entry is missing in the database for the second request it returns immediately with status 404, 422 or something whatever suits you.

Hope that helps anyone who gets here looking for an answer to this problem ;)

Related