Can't connect to webrtc-star with ssl

Guys thanks for your assistance so far, I’ve continued to struggle with the SSL setup of wws on the server, which is failing.

My new setup where I run my application runs app.xxx.com.conf on port 8765 which talks to the libp2p.xxx.com subdomain to engage libp2p on port 14577:

app.xxx.com.conf

server {
server_name app.xxx.com;
root /home/xxx/public_html/app;
index index.html;
location / {
proxy_pass http://localhost:8765;

if ($request_method = ‘OPTIONS’) {
add_header ‘Access-Control-Allow-Origin’ ‘’;
add_header ‘Access-Control-Allow-Methods’ ‘GET, POST, OPTIONS’;
#
# Custom headers and headers various browsers should be OK with but aren’t
#
add_header ‘Access-Control-Allow-Headers’ ‘DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range’;
#
# Tell client that this pre-flight info is valid for 20 days
#
add_header ‘Access-Control-Max-Age’ 1728000;
add_header ‘Content-Type’ ‘text/plain; charset=utf-8’;
add_header ‘Content-Length’ 0;
return 204;
}
if ($request_method = ‘POST’) {
add_header ‘Access-Control-Allow-Origin’ '
’ always;
add_header ‘Access-Control-Allow-Methods’ ‘GET, POST, OPTIONS’ always;
add_header ‘Access-Control-Allow-Headers’ ‘DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range’ always;
add_header ‘Access-Control-Expose-Headers’ ‘Content-Length,Content-Range’ always;
}
if ($request_method = ‘GET’) {
add_header ‘Access-Control-Allow-Origin’ ‘*’ always;
add_header ‘Access-Control-Allow-Methods’ ‘GET, POST, OPTIONS’ always;
add_header ‘Access-Control-Allow-Headers’ ‘DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range’ always;
add_header ‘Access-Control-Expose-Headers’ ‘Content-Length,Content-Range’ always;
}

}

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/app.xxx.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/app.xxx.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
if ($host = app.xxx.com) {
return 301 https://$host$request_uri;
} # managed by Certbot

listen 80;
server_name app.xxx.com;
return 404; # managed by Certbot

}

I’m still confused between some of the nuances such as 127.0.01 vs localhost,

my libp2p.xxx.com.conf,

server {
server_name libp2p.xxx.com;
root /home/xxx/public_html/libp2p;
index index.html;
location / {
proxy_pass http://localhost:14577;

}

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/libp2p.xxx.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/libp2p.xxx.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
if ($host = libp2p.xxx.com) {
return 301 https://$host$request_uri;
} # managed by Certbot

listen 80;
server_name libp2p.xxx.com;
return 404; # managed by Certbot

}

my application halts with an error

vendor.js:196874 WebSocket connection to ‘wss://app.xxx.com/sockjs-node/760/g5cqgxm4/websocket’ failed: