Hello, I tried looking for this issue already but wasn’t very successful so I have no other choice but to make this thread.
I followed Proxy Setup - Cfx.re Docs through completely and added the server to my nginx load balancer.
Now, when I start the server and I go to play.example.com, the cfx link does not resolve but if I go directly to the servers IP:30120 (skipping nginx load balancer), I get redirected to the cfx link but only in http, https gives me a self signed error for citzenfx.tls.donottrust or something like that.
If I go to play.example.com/info.json or any other json, it works.
Also, my srv/files folder for cache is empty on the nginx load balancer.
As expected after a few minutes of running the server I get
Server list query returned an error: System.Net.Http.HttpRequestException: Response status code does not indicate success: 521 (). <- System.Exception: Could not query via
https://play.example.com/ - check if your sv_listingHostOverride is correct
My host override
set sv_listingHostOverride "play.example.com"
my proxy vhost
proxy_cache_path /srv/cache levels=1:2 keys_zone=assets:48m max_size=10g ;
upstream backend {
server INTERNAL.IP:30120;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name play.example.com;
ssl_certificate /etc/nginx/ssl-certs/name.pem;
ssl_certificate_key /etc/nginx/ssl-certs/name.key;
access_log /var/log/nginx/reverse-access.log;
error_log /var/log/nginx/reverse-error.log;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass_request_headers on;
proxy_http_version 1.1;
proxy_pass http://backend;
}
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;
}
}
nginx.conf
stream {
upstream backend {
server INTERNAL.IP:30120;
}
server {
listen 30120;
proxy_pass backend;
}
server {
listen 30120 udp reuseport;
proxy_pass backend;
}
}
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.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
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/*;
}
My endpoint is set to the internal IP of the server the FiveM server is running on
set sv_endpoints "INTERNAL.IP:30120"
My nginx is set up to redirect http to https traffic, I’m using my CloudFlare Origin certs for the proxy vhost as everything on my infrastructure is running behind CloudFlare.
I tried disabling my auto https rule in nginx and adding a :80 listener in the proxy config but it didn’t help at all either. Also tried chaning proxy_pass-es to https instead of http, same result.
I can start a connection to the server using connect https://play.example.com/
but it hangs on Downloading resource manifest and then aborts connection. I believe this is due to my server cache folder on nginx not populating?
If anyone could share some insight on what I might be doing wrong I’d greatly appreciate it.
Thanks.