ResourceCashe:: AddEntry: Saved cashe corruption uncovered

Please help me fix the issue when setting up my fivem cache server and proxy i get corrupted file error as you can see in the image i inculded

Steps of installation:

  • installed fresh ubuntu in different server.
  • installed Nginx with stream module
  • linked my domain to that server as showin in the image
  • configured my fivem config file as showin in the image
  • copyed the cache files from my fivem server to the ubuntu server
  • when trying to download the files i get tihs error that showin in the image please help me what i’m missing at this point to resolve the issue?

FiveM Config Section:

proxy

set sv_forceIndirectListing true
set sv_listingHostOverride "fivem.domain.net"
set sv_proxyIPRanges "ProxyIP-ADDR/32"
set sv_endpoints "fivem-server-ipaddress:30120"

fileserver_remove ".*"
fileserver_add ".*" "https://fivem.domain.net/files"
adhesive_cdnKey "C7J0cc9I1JyCTg8A6kR6XxuSLsdT"
fileserver_list

/etc/nginx/nginx.conf

user www-data;

worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
	worker_connections 768;
}

http {
	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;
	keepalive_timeout 65;
	types_hash_max_size 2048;
	include /etc/nginx/mime.types;
	default_type application/octet-stream;
	ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
	ssl_prefer_server_ciphers on;
	access_log /var/log/nginx/access.log;
	error_log /var/log/nginx/error.log;
	gzip on;
	include /etc/nginx/conf.d/*.conf;
	include /etc/nginx/sites-enabled/*;
}
include /etc/nginx/stream-proxy.conf;

/etc/nginx/stream-proxy.conf

stream {
	upstream backend{
    	server fivem-server-ip:30120;
	}
	server {
    	listen 30120;
    	proxy_pass backend;
	}
	server {
    	listen 30120 udp reuseport;
    	proxy_pass backend;
	}
}

/etc/nginx/sites-available/default

# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#   	listen 80;
#   	listen [::]:80;
#
#   	server_name example.com;
#
#   	root /var/www/example.com;
#   	index index.html;
#
#   	location / {
#           	try_files $uri $uri/ =404;
#   	}
#}##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#

server {
    	listen 80 default_server;
    	listen [::]:80 default_server;

    	# SSL configuration
    	#
    	# listen 443 ssl default_server;
    	# listen [::]:443 ssl default_server;
    	#
    	# Note: You should disable gzip for SSL traffic.
    	# See: https://bugs.debian.org/773332
    	#
    	# Read up on ssl_ciphers to ensure a secure configuration.
    	# See: https://bugs.debian.org/765782
    	#
    	# Self signed certs generated by the ssl-cert package
    	# Don't use them in a production server!
    	#
    	# include snippets/snakeoil.conf;

    	root /var/www/html;

    	# Add index.php to the list if you are using PHP
    	index index.html index.htm index.nginx-debian.html;

    	server_name _;

    	location / {
            	# First attempt to serve request as file, then
            	# as directory, then fall back to displaying a 404.
            	try_files $uri $uri/ =404;
    	}

    	# pass PHP scripts to FastCGI server
    	#
    	#location ~ \.php$ {
    	#   	include snippets/fastcgi-php.conf;
    	#
    	#   	# With php-fpm (or other unix sockets):
    	#   	fastcgi_pass unix:/run/php/php7.4-fpm.sock;
    	#   	# With php-cgi (or other tcp sockets):
    	#   	fastcgi_pass 127.0.0.1:9000;
    	#}

    	# deny access to .htaccess files, if Apache's document root
    	# concurs with nginx's one
    	#
    	#location ~ /\.ht {
    	#   	deny all;
    	#}
}


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#   	listen 80;
#   	listen [::]:80;
#
#   	server_name example.com;
#
#   	root /var/www/example.com;
#   	index index.html;
#
#   	location / {
#           	try_files $uri $uri/ =404;
#   	}
#}

upstream backend {
	server_fivem_server_ip:30120;
}

proxy_cache_path /srv/cache levels=1:2 keys_zone=assets:48m max_size=20g inactive=2h;

server {
	listen 443 ssl;
	listen [::]:443 ssl;

	server_name fivem.domain.net;

	# SSL is highly encouraged but optional. If not using SSL, comment the below and change the listen blocks above.
	ssl_certificate /etc/nginx/certificate.pem;
	ssl_certificate_key /etc/nginx/privkey.pem;


	location / {
    	proxy_set_header Host $host;
    	proxy_set_header X-Real-Ip $remote_addr;
    	proxy_set_header X-Cfx-Source-Ip $remote_addr;
    	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    	proxy_pass_request_headers on;
    	proxy_http_version 1.1;
    	proxy_pass http://backend;
	}

	# if you do not wish to use the caching proxy, remove the below block
	location /files/ {
    	proxy_pass http://backend$request_uri;
    	add_header X-Cache-Status $upstream_cache_status;
    	proxy_cache_lock on;
    	proxy_cache assets;
    	proxy_cache_valid 1y;
    	proxy_cache_key $request_uri$is_args$args;
    	proxy_cache_revalidate on;
    	proxy_cache_min_uses 1;
	}
}

The Fix

FiveM Config Section:

proxy

set sv_forceIndirectListing true
set sv_listingHostOverride "fivem.domain.net"
set sv_proxyIPRanges "ProxyIP-ADDR/32"
set sv_endpoints "fivem-server-ipaddress:30120"

fileserver_add ".*" "https://real-proxy-ip-address/files"
adhesive_cdnKey "C7J0cc9I1JyCTg8A6kR6XxuSLsdT"
fileserver_list

add your cache files in the html/files directory
the files you want to add \data\cache\files

GOOD LUCK! EVERYONE.