VMware Cloud Community
LaaaaiiiT
Contributor
Contributor
Jump to solution

Redirecting from the Internet to the local network via NAT VSPHERE, ESXI.

Hello, recently there was a problem that vsphere should go online.
I have done address redirection and vsphere is loading for me, but when I authenticate, I have a constant loading of everything except the vsphere interface itself.

I assume that this is due to ports or the URL path, unfortunately everything I found on the Internet did not help, please help.

Excerpt from nginx for redirection:

server {
      listen 443;
      server_name vc.ktk-45.ru;
      location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header Host $host;
            proxy_pass https://vc.ktk-45.ru;
      }
}

Reply
0 Kudos
1 Solution

Accepted Solutions
LaaaaiiiT
Contributor
Contributor
Jump to solution

I also made a redirect to websocket by brute force, since I don't really understand it.

Something like this:

server {
   server_name vc.ktk-45.ru;

   location / {
       add_header Access-Control-Allow-Origin "https://ktk-45.ru/";
       add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS, PATCH";
       add_header Access-Control-Allow-Headers "Keep-Alive,User-Agent,X-Requested-With,Cache-Control,Content-T$ add_header Access-Control-Expose-Headers "Keep-                       Alive,User-Agent,X-Requested-With,Cache-Control,Content-$ add_header Access-Control-Allow-Credentials "true";

       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $remote_addr;
       proxy_set_header Host $host;
       proxy_pass https://10.14.206.249:443;
   }

   # WebSocket DOCK
   location /ui/app-fabric/fabric {
       proxy_pass https://10.14.206.249:443;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
       proxy_set_header Host $host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $remote_addr;
   }

   listen 443 ssl; # managed by Certbot
   ssl_certificate /home/user/fullchain.pem; # managed by Certbot
   ssl_certificate_key /home/user/privatekey.pem; # managed by Certbot
   include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
   ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
But there are some problems with loading, as if it polls the same thing several times.

View solution in original post

Reply
0 Kudos
3 Replies
CallistoJag
Hot Shot
Hot Shot
Jump to solution

yes the url path is probably your issue, not sure how to work around that one....
Reply
0 Kudos
LaaaaiiiT
Contributor
Contributor
Jump to solution

I got some more information.

I changed the certificate to self-signed vsphere, where I did the redirect.

I saw an error that comes across in the web interface.

Error: WebSocket connection to 'wss://vc.ktk-45.ru/ui/app-fabric/fabric' failed

I realized that I need to redirect the websocket of this address to my local esxi servers.

 

But I have 3 of them and they are in a cluster, so I do not know what to do.

Reply
0 Kudos
LaaaaiiiT
Contributor
Contributor
Jump to solution

I also made a redirect to websocket by brute force, since I don't really understand it.

Something like this:

server {
   server_name vc.ktk-45.ru;

   location / {
       add_header Access-Control-Allow-Origin "https://ktk-45.ru/";
       add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS, PATCH";
       add_header Access-Control-Allow-Headers "Keep-Alive,User-Agent,X-Requested-With,Cache-Control,Content-T$ add_header Access-Control-Expose-Headers "Keep-                       Alive,User-Agent,X-Requested-With,Cache-Control,Content-$ add_header Access-Control-Allow-Credentials "true";

       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $remote_addr;
       proxy_set_header Host $host;
       proxy_pass https://10.14.206.249:443;
   }

   # WebSocket DOCK
   location /ui/app-fabric/fabric {
       proxy_pass https://10.14.206.249:443;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
       proxy_set_header Host $host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $remote_addr;
   }

   listen 443 ssl; # managed by Certbot
   ssl_certificate /home/user/fullchain.pem; # managed by Certbot
   ssl_certificate_key /home/user/privatekey.pem; # managed by Certbot
   include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
   ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
But there are some problems with loading, as if it polls the same thing several times.

Reply
0 Kudos