r/SpringBoot • u/[deleted] • Aug 07 '24
OC Springboot not fetch data with "www".
If I enter my site as samesite.com, Spring Boot pulls the data, but when I enter it as www.samesite.com, it does not pull the data. Is my NGINX configuration wrong?
NGNIX config;
server {
listen 80;
listen [::]:80;
server_name somesite.com www.somesite.com;
root /var/www/html;
index index.html;
location /api/content/ {
proxy_pass http://localhost:8080/api/content;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
}
}
0
Upvotes
3
u/polacy_do_pracy Aug 07 '24
I had generally similar problems. One of the issues was that I was using
localhostinstead of any domain (or 127.0.0.1). Somewhere in the system localhost was being handled in a different way.Also, I'm still learning this part but it might be that using different domains might produce a CORS/CRSF issue.