diff --git a/frontend/proxy.conf.json b/frontend/proxy.conf.json index 8a5402c52..a2f737d47 100644 --- a/frontend/proxy.conf.json +++ b/frontend/proxy.conf.json @@ -2,5 +2,17 @@ "/api": { "target": "http://localhost:8999/", "secure": false + }, + "/ws": { + "target": "http://localhost:8999/", + "secure": false, + "ws": true + }, + "/electrs": { + "target": "https://www.blockstream.info/api/", + "secure": false, + "pathRewrite": { + "^/electrs": "" + } } } \ No newline at end of file diff --git a/frontend/src/app/services/electrs-api.service.ts b/frontend/src/app/services/electrs-api.service.ts index 2e1e944e9..ae1d1a856 100644 --- a/frontend/src/app/services/electrs-api.service.ts +++ b/frontend/src/app/services/electrs-api.service.ts @@ -3,7 +3,7 @@ import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { Block, Transaction, Address, Outspend, Recent } from '../interfaces/electrs.interface'; -const API_BASE_URL = 'https://www.blockstream.info/testnet/api'; +const API_BASE_URL = document.location.protocol + '//' + document.location.hostname + ':' + document.location.port + '/electrs'; @Injectable({ providedIn: 'root' diff --git a/frontend/src/app/services/websocket.service.ts b/frontend/src/app/services/websocket.service.ts index 8b167ea2a..fbf4faed0 100644 --- a/frontend/src/app/services/websocket.service.ts +++ b/frontend/src/app/services/websocket.service.ts @@ -6,7 +6,7 @@ import { StateService } from './state.service'; import { Block, Transaction } from '../interfaces/electrs.interface'; const WEB_SOCKET_PROTOCOL = (document.location.protocol === 'https:') ? 'wss:' : 'ws:'; -const WEB_SOCKET_URL = WEB_SOCKET_PROTOCOL + '//' + document.location.hostname + ':8999'; +const WEB_SOCKET_URL = WEB_SOCKET_PROTOCOL + '//' + document.location.hostname + ':' + document.location.port + '/ws'; @Injectable({ providedIn: 'root'