Spaces:
Sleeping
Sleeping
fixing https updating app.js with window protocol
Browse files- frontend/src/App.js +5 -2
frontend/src/App.js
CHANGED
@@ -74,14 +74,17 @@ const getAPIURL = () => {
|
|
74 |
return 'http://localhost:8000';
|
75 |
}
|
76 |
|
|
|
|
|
|
|
77 |
// When running in production, use the same host with the backend port
|
78 |
// This works because we're exposing the backend port in docker-compose
|
79 |
// If port is 7860, use the same port (Hugging Face scenario)
|
80 |
const currentPort = window.location.port;
|
81 |
if (currentPort === '7860') {
|
82 |
-
return
|
83 |
} else {
|
84 |
-
return
|
85 |
}
|
86 |
};
|
87 |
|
|
|
74 |
return 'http://localhost:8000';
|
75 |
}
|
76 |
|
77 |
+
// Get current protocol (http: or https:)
|
78 |
+
const protocol = window.location.protocol;
|
79 |
+
|
80 |
// When running in production, use the same host with the backend port
|
81 |
// This works because we're exposing the backend port in docker-compose
|
82 |
// If port is 7860, use the same port (Hugging Face scenario)
|
83 |
const currentPort = window.location.port;
|
84 |
if (currentPort === '7860') {
|
85 |
+
return `${protocol}//${window.location.hostname}:${currentPort}`;
|
86 |
} else {
|
87 |
+
return `${protocol}//${window.location.hostname}:8000`;
|
88 |
}
|
89 |
};
|
90 |
|