# Maxmind R2 presigned URLs

**URL:** https://meta.discourse.org/t/maxmind-r2-presigned-urls/298941
**Category:** Self-hosting
**Tags:** maxmind
**Created:** [March 11, 2024, 10:10pm UTC](https://meta.discourse.org/t/maxmind-r2-presigned-urls/298941 "2024-03-11T22:10:34Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![mcdanlj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcdanlj/32/131829_2.png) [@mcdanlj](https://meta.discourse.org/u/mcdanlj)
#### Post date: [March 11, 2024, 10:10pm UTC](https://meta.discourse.org/t/maxmind-r2-presigned-urls/298941/1 "2024-03-11T22:10:34Z")

</div>

Just got an email from Maxmind:

> As of Wednesday, May 1, 2024, we will use R2 presigned URLs for all database downloads in order to increase the security and reliability of our services.

Does anyone know whether this affects Discourse’s Maxmind usage?

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [March 11, 2024, 10:30pm UTC](https://meta.discourse.org/t/maxmind-r2-presigned-urls/298941/2 "2024-03-11T22:30:27Z")

</div>

Good point!

Based on this article

> **[GeoIP Release Notes - 2024 Archive](https://dev.maxmind.com/geoip/release-notes/2024/)**
>
> GeoNames monthly diff report December 2024 December 19, 2024 GeoNames monthly diff report (December 2024)
> GeoIP and GeoLite databases incorporate GeoNames geographical data, which is made available under the Creative Commons Attribution 4.0...

It would seem that a direct link (what Discourse uses) will be fine as it is. This means it will be  
automatically redirected to their new URLs. So far, so good.

However, from what I see in the code, it doesn’t follow redirection: This will likely fail.  
You would need to update the URL or allow redirection to fix this.

> <https://github.com/discourse/discourse/blob/main/lib/discourse_ip_info.rb#L36-L46>

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [March 23, 2024, 1:35pm UTC](https://meta.discourse.org/t/maxmind-r2-presigned-urls/298941/6 "2024-03-23T13:35:19Z")

</div>

> [@Arkshine](#):
>
> However, from what I see in the code, it doesn’t follow redirection: This will likely fail.

It does.

> [@Fail to download maxmind db with valid key & can download the DB from inside container](https://meta.discourse.org/t/fail-to-download-maxmind-db-with-valid-key-can-download-the-db-from-inside-containerr/300590/2):
>
> Does it work better with follow\_redirect: true? As per a recent change, MaxMind changed their URL to download, but you can keep the original one as long you allow redirection.

[https://github.com/discourse/discourse/pull/26333](https://github.com/discourse/discourse/pull/26333)

---

<div class="post-metadata">

### Author: ![mcdanlj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcdanlj/32/131829_2.png) [@mcdanlj](https://meta.discourse.org/u/mcdanlj)
#### Post date: [March 23, 2024, 1:38pm UTC](https://meta.discourse.org/t/maxmind-r2-presigned-urls/298941/7 "2024-03-23T13:38:51Z")

</div>

I wonder whether they recently started using redirects **before** implementing the presigned URLs.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [March 23, 2024, 1:39pm UTC](https://meta.discourse.org/t/maxmind-r2-presigned-urls/298941/8 "2024-03-23T13:39:37Z")

</div>

I just know that changing the code to allow redirects makes it work.

---

<div class="post-metadata">

### Author: ![mcdanlj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcdanlj/32/131829_2.png) [@mcdanlj](https://meta.discourse.org/u/mcdanlj)
#### Post date: [March 23, 2024, 1:40pm UTC](https://meta.discourse.org/t/maxmind-r2-presigned-urls/298941/9 "2024-03-23T13:40:44Z")

</div>

I was about to start looking to see whether there were any tests that would fail with that change, and you beat me to it! ☺

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [March 23, 2024, 1:51pm UTC](https://meta.discourse.org/t/maxmind-r2-presigned-urls/298941/10 "2024-03-23T13:51:05Z")

</div>

Well, it was a single word, and I’d already been hacking at the code on a live site, so it wasn’t that hard. Looks like all of the automated tests passed. . .

---

<div class="post-metadata">

### Author: ![mcdanlj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcdanlj/32/131829_2.png) [@mcdanlj](https://meta.discourse.org/u/mcdanlj)
#### Post date: [March 23, 2024, 2:19pm UTC](https://meta.discourse.org/t/maxmind-r2-presigned-urls/298941/11 "2024-03-23T14:19:03Z")

</div>

Oh, I’d been thinking that I would have to remember how to run all the tests locally, and I’ve reinstalled since the last time I did that so I was pretty sure that would be a rabbit hole of finding and installing dependencies… Just let the automation take care of it is smart. ☺
