fix: force UI to use IPv4 (127.0.0.1) for API endpoints
Previously, the API endpoint was defined using `localhost`, which could resolve to the IPv6 address `::1`. This caused issues because the Portmaster core service is listening on `127.0.0.1:817` and only fast-tracking connections to that specific IPv4 address.
This commit is contained in:
@@ -43,7 +43,7 @@ export interface AuthKeyResponse {
|
||||
export class MetaAPI {
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
@Inject(PORTMASTER_HTTP_API_ENDPOINT) @Optional() private httpEndpoint: string = 'http://localhost:817/api',
|
||||
@Inject(PORTMASTER_HTTP_API_ENDPOINT) @Optional() private httpEndpoint: string = 'http://127.0.0.1:817/api',
|
||||
) { }
|
||||
|
||||
listEndpoints(): Observable<MetaEndpoint[]> {
|
||||
|
||||
@@ -48,10 +48,10 @@ export class PortmasterAPIModule {
|
||||
*/
|
||||
static forRoot(cfg: ModuleConfig = {}): ModuleWithProviders<PortmasterAPIModule> {
|
||||
if (cfg.httpAPI === undefined) {
|
||||
cfg.httpAPI = `http://${window.location.host}/api`;
|
||||
cfg.httpAPI = `http://127.0.0.1:817/api`;
|
||||
}
|
||||
if (cfg.websocketAPI === undefined) {
|
||||
cfg.websocketAPI = `ws://${window.location.host}/api/database/v1`;
|
||||
cfg.websocketAPI = `ws://127.0.0.1:817/api/database/v1`;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user