S3 Endpoint change procedure?

I have never tried using an S3 server in a non-standard port, because that is not something we test for.

That said, can you try setting up the S3 Endpoint in an environment variable on the app.yml file?

env:
   # current settings ...
   DISCOURSE_S3_ENDPOINT:  http://discourse.domain.tld:9001