[openstreetmap/openstreetmap-website] Compress plain GPX uploads with gzip (PR #7124)

Ruben L. Mendoza notifications at github.com
Tue Jul 7 22:07:39 UTC 2026


Rub21 left a comment (openstreetmap/openstreetmap-website#7124)

Here is an example, tied to what Tom asked about:

> What happens if somebody uses S3 and doesn't enable it? The traces still get compressed but don't get automatically decompressed on download?

### Let's say we merge this PR and run it on plain S3 for now, without GpxS3.

A user uploads route.gpx:

- The model gzips it before storing, so server_gzipped = true.
- S3 stores the gzipped file, but plain S3 does not add the Content-Encoding: gzip header.

Later the user downloads it:

- gzipped_by_server? = true (we did gzip it).
- store_serves_gzip? = false (plain S3, no header).
- So the code goes to send_data: the server unzips the file and sends a plain GPX. The user gets route.gpx back, same as before this PR.

### Now let's say we enable GpxS3 later in the deploy

A user uploads route.gpx:

- The model gzips it before storing, so server_gzipped = true (same as before).
- GpxS3 stores the gzipped file and adds the Content-Encoding: gzip header.

Later the user downloads it:

- gzipped_by_server? = true (we did gzip it).
- store_serves_gzip? = true (GpxS3 adds the header).

So the code redirects to S3. S3 serves the gzipped file with the header, and the browser unzips it. The server does no work. The user still gets route.gpx back.

Either way the user gets a plain GPX. The only difference is who unzips: on plain S3 and Disk the server does it (send_data), on GpxS3 the browser does it (redirect). store_serves_gzip? is the check that picks between the two, so it is needed.

All three storages compress the file. Only GpxS3 serves the header, so only there the browser unzips:

| Storage | compresses | Content-Encoding header | who unzips |
|---|---|---|---|
| GpxS3 | yes | yes | browser (redirect) |
| S3 | yes | no | server (send_data) |
| Disk | yes | no | server (send_data) |


-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/7124#issuecomment-4909477836
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/7124/c4909477836 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260707/42f0e2b9/attachment-0001.htm>


More information about the rails-dev mailing list