Configure API requests for reverse proxy setup
- Updated all API endpoints to use /rechner/api/ path - Removed CSP localhost restriction for reverse proxy compatibility - Added nginx proxy configuration for API requests - Should now work through HTTPS reverse proxy
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdn.jsdelivr.net;
|
||||
style-src 'self' 'unsafe-inline';
|
||||
img-src 'self' data:;
|
||||
connect-src 'self' http://localhost:3001;
|
||||
connect-src 'self';
|
||||
">
|
||||
<title>Rechner</title>
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
const updateCoinTrackersToBackend = (trackers) => {
|
||||
console.log("Saving trackers to backend:", trackers);
|
||||
|
||||
fetch('http://localhost:3001/api/coinTrackers', {
|
||||
fetch('/rechner/api/coinTrackers', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -1182,7 +1182,7 @@
|
||||
const loadCoinTrackers = () => {
|
||||
console.log("Loading trackers from backend...");
|
||||
|
||||
fetch('http://localhost:3001/api/coinTrackers')
|
||||
fetch('/rechner/api/coinTrackers')
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
@@ -1639,7 +1639,7 @@
|
||||
document.getElementById('createBackupBtn').textContent = 'Creating backup...';
|
||||
|
||||
// Make request to API
|
||||
fetch(`http://localhost:3001/api/backup/create${backupName ? `?name=${encodeURIComponent(backupName)}` : ''}`)
|
||||
fetch(`/rechner/api/backup/create${backupName ? `?name=${encodeURIComponent(backupName)}` : ''}`)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`Network error: ${response.status}`);
|
||||
@@ -1670,7 +1670,7 @@
|
||||
|
||||
// Function to load the list of available backups
|
||||
const loadBackupList = () => {
|
||||
fetch('http://localhost:3001/api/backup/list')
|
||||
fetch('/rechner/api/backup/list')
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
@@ -1795,7 +1795,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
fetch(`http://localhost:3001/api/backup/restore/${filename}`)
|
||||
fetch(`/rechner/api/backup/restore/${filename}`)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
|
||||
Reference in New Issue
Block a user