admin管理员组

文章数量:1122832

I installed rancher and k3s on 3 VMs: 192.168.0.150 control plane 192.168.0.151 worker 192.168.0.152 worker

I followed the tutorial to configure nginx:

worker_processes 4;
worker_rlimit_nofile 40000;
load_module /usr/lib/nginx/modules/ngx_stream_module.so;

events {
  worker_connections 8192;
}

stream {
  upstream rancher_servers_http {
    least_conn;
    server 192.168.0.150:80 max_fails=3 fail_timeout=5s;
    server 192.168.0.151:80 max_fails=3 fail_timeout=5s;
    server 192.168.0.152:80 max_fails=3 fail_timeout=5s;
  }
  server {
    listen 80;
    proxy_pass rancher_servers_http;
  }
}

http {
  upstream rancher_servers_https {
    least_conn;
    server 192.168.0.150:443 max_fails=3 fail_timeout=5s;
    server 192.168.0.151:443 max_fails=3 fail_timeout=5s;
    server 192.168.0.152:443 max_fails=3 fail_timeout=5s;
  }
  server {
    listen 443 ssl;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!MD5;
    ssl_certificate /cert/tls.crt;
    ssl_certificate_key /cert/tls.key;
    ssl_trusted_certificate /cert/cacerts.pem;
    error_log /var/log/nginx/rancher_error_log error;
    location / {
      proxy_pas https://rancher_servers_https;
      proxy_set_header Host rancher.example;
      proxy_ssl_server_name on;
      proxy_ssl_name rancher.example;
      add_header Access-Control-Allow-Origin *;
    }
  }
}

I access Rancher and I get the login page using the url example

but I get the following errors when I try to connect:

"An error occurred logging in: Network Error"

and in my browser debugger: "Access to XMLHttpRequest at '' from origin '' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource."

what did i forget to do?

Thanks for your help

本文标签: Rancher Setting up an external NGINX Load BalancerStack Overflow