mattermost-community / mattermost-plugin-memes

Add culture to your Mattermost with memes 🔌

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Verify Image Proxy requests from server (Image Proxy and Post Metadata do not work)

cmeadows opened this issue · comments

I am experiencing an issue with this plugin on the Desktop App for Mac and through the browser. On the iOS app, this plugin works as expected.

In the interfaces that are not working, a blank message is posted and the following logs are printed to the Server Logs (this is in debug mode already):

{"level":"warn","ts":1553089421.5354636,"caller":"app/post_metadata.go:465","msg":"Failed to write link metadata","request_url":"https://<mattermost_server>/plugins/memes/templates/brace-yourselves.jpg","error":"SqlLinkMetadataStore.Save: store.sql_link_metadata.save.app_error, url=https://<mattermost_server>/plugins/memes/templates/brace-yourselves.jpg, Error 1062: Duplicate entry '2412853382' for key 'PRIMARY'"}
{"level":"error","ts":1553089421.671403,"caller":"log/log.go:289","msg":"forbidden content-type: \"text/html\"","source":"stdlog"}

Update 3/22/2019:

The error is the image proxy complaining that whatever link is being posted by the meme plugin is not an image. It looks like the meme plugin needs the user to log in or else it just returns an error page. Perhaps we need some way for plugins to verify that a request is coming from the image proxy since the current method of checking for the Mattermost-User-Id header doesn't work if the request comes from the server (either the image proxy or the post metadata logic).

I have removed the image proxy for now, and the memes display!

@hmhealey Do you have an idea why this is happening?

The warning (which has since been changed to a debug message) if fine to ignore since it just means multiple clients are trying to load the image at once.

The error is the image proxy complaining that whatever link is being posted by the meme plugin is not an image. It looks like the meme plugin needs the user to log in or else it just returns an error page. Perhaps we need some way for plugins to verify that a request is coming from the image proxy since the current method of checking for the Mattermost-User-Id header doesn't work if the request comes from the server (either the image proxy or the post metadata logic)

@hmhealey thanks for tracking down the cause! I turned off the local image proxy and the memes magically appeared!

I changed this issue with the additional information that you discovered!