UD behind Proxy (Nginx) - Bad request on fetchPOST

Hi,
I have an instance of UD 2.9.0 behind a NGINX; I have a UDSelect based on a list of environment. When the user select some environment it actualize an UDGrid (in fact it actualize a Session variable and trigger a refresh of the UDGrid which is based on this Session variable).


New-UDSelect -Id “UDSelect_ListOfEnvsToCheck_EVI” -Label “Environments” -MultiSelect -Option {
$i = 0
foreach ($env in $listOfEnvs) {
if ($Session:ListOfEnvsToCheck_EVI -like $env) {
New-UDSelectOption -Name $env -Value $i -Selected
}
else {
New-UDSelectOption -Name $env -Value $i
}
$i++
}
} -OnChange {

Actualize UDGrid based on selection

$ListOfSelectedValues = @()

foreach ($value in ((Get-UDElement -Id “UDSelect_ListOfEnvsToCheck_EVI”).Attributes[“value”] | ConvertFrom-Json)) {
$ListOfSelectedValues += $listOfEnvs[$value].ToString()
}

$Session:ListOfEnvsToCheck_EVI = $ListOfSelectedValues | Sort-Object
Sync-UDElement -Id “UDGRID_DEPLOYED” -Broadcast
}

New-UDGrid -Id “UDGRID_DEPLOYED” -Title “SERVICES” -NoPaging -Endpoint { Get-ServicesVersion -ListOfEnvsToCheck $Session:ListOfEnvsToCheck_EVI | Out-UDGridData }

It works well when I’m connected directly through the UD-Website, but when I use it through the Nginx Proxy, I have a Bad Request for the POST request done by the Get-UDElement instruction, which then return nothing and so don’t actualize anything.

Here is my Nginx configuration :

server {
listen 443;
server_name myserver.mydomain.com;

ssl_certificate /etc/ssl/cert/cert.crt;
ssl_certificate_key /etc/ssl/cert/server.key;
ssl on;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_protocols TLSv1.2;
ssl_ciphers “ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384”;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/ssl/dhparam.pem;
add_header Strict-Transport-Security “max-age=63072000; includeSubdomains;”;

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;

  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "Upgrade";
  proxy_set_header Host $host;
  proxy_http_version 1.1;
  proxy_set_header content-type "application/json";
  proxy_cache_bypass $http_upgrade;
  proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header   X-Forwarded-Proto $scheme;
  proxy_pass http://myuddashboard:8080/;
  proxy_read_timeout 86400;

}
}

Do you have any idea where the trouble is ?

Thank you,
Lionel.

Little UP for this topic, does anyone have any idea plz?

I haven’t done this myself but @artvandelay440 did. He has a post here that might be helpful: How To: Run Universal Dashboard with Ubuntu and Nginx (With HTTPS!)