Mattermost, Nginx and cache


#1

Good morning,

I’m using some Mattermost instances proxied by an Nginx service. The Nginx service is configured as you suggested in your doc but with one difference. I have several Mattermost behind one Nginx virtualhost. Can due to this reason and difference with your proposed config, have impredictible results in different Mattermost instances due to cached content?. Each instance is accesed with a completely different URL. For instance :

The question is can something not corresponding to a Mattermost instance, appear there due to a non corresponding to the instance cached content?. Would be better to be using different vhosts?. The main reason I use this config is for simplicity and due to the wilcard certificate I have bought… for avoid having issues with that too…

Have you mates ever experienced issues like this (supposed and not reproduced yet at least) with the cache?.

Best regards,


#2

Hi @egoitz, thank you for reaching out!

Just wanted to give you a quick update that I’ve asked our engineers to take a look at this.


#3

Many many thanks!!! :slight_smile: :slight_smile:


#4

Multiple Virtual Hosts with same IP and SSL/TLS is not supported by all the browser, so it can generate some problems deciding which virtual host is really accessed.

You can see an explanation of this here: https://serverfault.com/a/583253

I’m not 100% sure that’s the problem, but could be related to that.


#5

Hi Jespino,

The question mainly was… (perhaps I have not explain it properly too… It’s perhaps, more or less a paranoid question perhaps… :slight_smile: ). If you have a Nginx cache enabled (with the line proposed by you in your docs :

proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=mattermost_cache:10m max_size=3g inactive=120m use_temp_path=off;

And later you have… instead of one backend (for one Mattermost server) several ones… for multiple Mattermost instances… can it cache one Mattermost’s instance info and show into another instance accesses?. The URL for accesing one instance… or another… is different… I mean :

later are proxy_passed by Nginx to for instance… instance1:8065, instance2:8065… and so on…

Am I in risk of accessing to an user uploaded… imagine a file named… 123.png if someone at another instance of Mattermost and with another URL uploads a 123.png shared file?.

That was the real question :slight_smile:
Best regards,


#6

Hi @egoitz,

The question is more about nginx, and it depends on the nginx configuration. You can use the same file because it store the data bound to a cache key which is an MD5 of the proxy_cache_key defined by the configuration (by default $scheme$proxy_host$uri$is_args$args). Looks like it is safe for multiple virtual hosts using multiple instances behind.

Regards.


#7

Hi Jespino,

Many many thanks really.

Best regards,