chime / terraform-aws-alternat

High availability implementation of AWS NAT instances.
MIT License
1.06k stars 66 forks source link

Make connectivity check more robust #91

Closed kristian-lesko closed 5 months ago

kristian-lesko commented 5 months ago

Some endpoints chosen for connectivity check may return an error, for example, due to rate limits being exceeded. However, as long as the given website could be reached, it means the connection's working and fallback to NAT Gateway should not be initiated. Such occurrences can be simply logged but treated as check success.

Add a User-Agent header to connection check requests, which also prevents some websites from returning an error in the first place.

kristian-lesko commented 5 months ago

We were using GitHub API as one of the check URLs, where the rate limit is 60 requests per hour without authentication. An endpoint hosted by CloudFlare, in turn, returned Forbidden errors when the User-Agent was not set.

Thanks for the merge!