I have a problem with my Angular 15 Frontend app inside Minikube cluster. For deploying my app in Minikube, I add the k8s services URLs to environment files and Angular/Nginx sends me back to localhost - not to desired servcice URL.
environment.development.ts
export const environment = {
production: false,
serviceURL: 'http://backend.namespace.svc.cluster.local:8000',
};
service.ts
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { User } from './user';
import { environment } from '../../environments/environment'
@Injectable({
providedIn: 'root'
})
export class MainService {
baseUrl = environment.serviceURL+'/user/'
httpHeaders = new HttpHeaders;
constructor(
private http: HttpClient,
) { }
user(user:any): Observable<User> {
return this.http.get<User>(this.baseUrl)
}
}
With these settings Angular sends me back to localhost, where I get an 404 error where cannot find the 'http://localhost:4200/user/'
When I try to curl service url ( curl http://backend.namespace.svc.cluster.local:8000 ) from frontend pod I get a correct response.
Can someone advise me how to correctly connect angular frontend with django backend, please?