简体   繁体   中英

JQuery getJSON CORS error even though not making Cross Origin Request?

I have my website deployed on a Pi on my school server. The JS contains calls that make a GET request to the same domain. (It runs Flask). Why is this considered a cross origin request when I'm not trying to hit a different domain?

My js scripts are in a directory other than the document root. You can also inspect the elements in the browser directly.

.
├── configs.js
├── index.html
├── logs.html
├── node_modules
│   └── all my libraries
├── README.md
└── resources
    ├── css
    │   └── style.css
    ├── images
    │   └── dvc.png
    └── js
        ├── log-chart.js
        └── script.js

41 directories, 472 files

Port numbers are considered part of the domain when testing cross-origin requests, so it has to be going to the same port as the requesting page. Your website is http://dvc-raspberrypi.ucsd.edu/ , but you're trying to access http://dvc-raspberrypi.ucsd.edu:5000/door . Port 5000 makes them different origins.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM