/media/ vs /proxy/ issue

Edit: Issue resolved, thank you!

Hi floaty and team!

On Kaia’s behest, I moved brotka.st to a different VPS with more space and migrated it to a dockerized setup following the Migrating to a Docker Installation guide and added media.brotka.st. I enabled the media_proxy during the migration. Previously it was switched off.

Remote new media fully works under media.brotka.st/proxy/. However, media.brotka.st/media/ images and uploads via the FE are still broken.

The media are located in /opt/akkoma/uploads on the host and are correctly mounted into the Docker container. Both proxy and media content is located there?

If one tries to upload via the FE, two files appear in the /opt/akkoma/uploads, one with the actual extension, one with a 10 char scrambled one. Both cannot be accessed via the FE.

In prod.secret.exs:

config :pleroma, :media_proxy,
  enabled: true,
  redirect_on_failure: true,
  base_url: "https://media.brotka.st/"
  # No other config here
...
config :pleroma, Pleroma.Upload,
  base_url: "https://media.brotka.st/media" # Following your blog post about the update
  # I also tried base_url: "https://media.brotka.st/" to no avail
  # No other config here. Missing something here?
...
config :pleroma, :instance, static_dir: "/opt/akkoma/instance/static"
config :pleroma, Pleroma.Uploaders.Local, uploads: "/opt/akkoma/uploads"

In /etc/caddy/Caddyfile reverse proxy on the host, taken from your example:

https://brotka.st:443 {
	log {
		output file /var/log/caddy/akkoma.log
	}

	encode gzip
	reverse_proxy localhost:4000

	# Uncomment if using a separate media subdomain
	@mediaproxy path /media/* /proxy/*
	handle @mediaproxy {
		redir https://media.brotka.st{uri} permanent
	}
}

https://media.brotka.st {
	@mediaproxy path /media/* /proxy/*
	reverse_proxy @mediaproxy 127.0.0.1:4000 {
		transport http {
			response_header_timeout 10s
			read_timeout 15s
		}
	}
}

Thanks for your help!

One issue was in prod.secret.exs:

config :pleroma, configurable_from_database: true

The path in AdminFE was still /var/lib/akkoma/.... and putting it to the following resolved the issue:

image

Now the previously uploaded media before the switch to Docker works again. However uploading new media is still broken.

When uploading new images, they are not displayed on the FE and cannot be pulled remotely due to their link being

https://media.brotka.st/proxy/{some_chars}/{file_hash}.jpg

image

However, they are available under
https://media.brotka.st/media/{file_hash}.jpg
image


Edit 2:
After several rounds of experiments, this seems to work. Important final slash?
image

ah apologies i didn’t see this when it was a problem

i don’t think a slash is strictly needed, it sounds like your media proxy and media upload configs got crossed?

When uploading new images, they are not displayed on the FE and cannot be pulled remotely due to their link being

https://media.brotka.st/proxy/{some_chars}/{file_hash}.jpg

this soooounds like maybe some config had the uploader url using the proxy url?

1 Like