Greetings! I’m relatively new to Nginx and have encountered a challenge that requires some assistance. I have Nexus deployed in a Kubernetes cluster with serviceType=LoadBalancer accessible at http://node-ip:30001, and it’s functioning smoothly.
Now, I’m aiming to run Nexus behind a reverse proxy using Nginx, accessible at https://nexus.example.com. To achieve this, I’ve configured the proxy with the following
server {
listen 80;
server_name nexus.example.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name nexus.example.com;
modsecurity on;
modsecurity_rules_file /etc/nginx/modsecurity/modsecurity.conf;
ssl_certificate /etc/nginx/ssl/public.pem;
ssl_certificate_key /etc/nginx/ssl/private.key;
rewrite ^(/.*)\.html(\?.*)?$ $1$2 redirect;
rewrite ^/(.*)/$ /$1 redirect;
location / {
proxy_pass http://node-ip:30001;
add_header X-Frame-Options "ALLOWALL";
add_header Content-Security-Policy "frame-ancestors 'self' *";
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
add_header 'Access-Control-Allow-Origin' '*' always;
}
error_page 404 /404.html;
error_page 500 501 502 503 504 /50x.html;
}
With the provided configuration, I can access Nexus, however, it returns the following error:
Uncaught SecurityError: Failed to read a named property 'document' from 'Window': Blocked a frame with origin "https://nexus.autosdet.com" from accessing a cross-origin frame. (https://nexus.example.com/static/nexus-coreui-bundle.js?_v=3.64.0-04&_e=OSS&_c=2024-01-12-1451-00513:2)
I’m seeking insights into what might be missing or incorrectly configured. Any thoughts or suggestions?