You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
eventSource.onmessage = function (event) {
const data = JSON.parse(event.data);
const text = data.text;
$('#ai_whos_on_duty_displaying').append(text);
};
and the browser says:
Access to resource at 'http://192.168.88.144:8080/v1' from origin 'http://192.168.125.21' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
EventSource failed
GET http://192.168.88.144:8080/v1 net::ERR_FAILED 308 (PERMANENT REDIRECT)
I'm gessing if it has anything to do with the altered port 8080?
Tried all day to solve this but not working.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Self Checks
1. Is this request related to a challenge you're experiencing? Tell me about your story.
my .ENV is set as default:
WEB_API_CORS_ALLOW_ORIGINS=*
CONSOLE_CORS_ALLOW_ORIGINS=*
but when my html page need to fetch the api 'http://192.168.88.144:8080/v1', to listen for streaming,
the browser always pop up errors:
//JS starts ======================================================
const apiUrl = 'http://192.168.88.144:8080/v1';
const eventSource = new EventSource(apiUrl, {
headers: {
'Authorization': 'Bearer app-ycYinfSsr5RxrPAfmkzfd***'
}
});
eventSource.onmessage = function (event) {
const data = JSON.parse(event.data);
const text = data.text;
$('#ai_whos_on_duty_displaying').append(text);
};
eventSource.onerror = function (error) {
console.error('EventSource failed:', error);
eventSource.close();
};
//JS ends ======================================================
and the browser says:
Access to resource at 'http://192.168.88.144:8080/v1' from origin 'http://192.168.125.21' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
EventSource failed
GET http://192.168.88.144:8080/v1 net::ERR_FAILED 308 (PERMANENT REDIRECT)
I'm gessing if it has anything to do with the altered port 8080?
Tried all day to solve this but not working.
2. Additional context or comments
No response
Beta Was this translation helpful? Give feedback.
All reactions