I have manage proxy file in my front angular. I have two back-end symfony. the first back send me jwt and second other operation. Now my second back can communicate with my front but, my first back (jwt) do not receive request to get token.
This is my proxy :
const PROXY_CONFIG = [
{
context: [
'/auth/*/**'
],
target: 'http://localhost:8088',
secure: false,
logLevel: 'debug',
changeOrigin: true
},
{
context: [
'/api/*/**'
],
target: 'http://fiberready',
secure: false,
logLevel: 'debug',
changeOrigin: true
},
{
context: [
'/assets/env/env.json',
],
target: 'http://127.0.0.1:4200/assets/env/env.local.json',
secure: false,
pathRewrite: {
"^/assets/env/env.json": ""
}
}
];
module.exports = PROXY_CONFIG;
And here, my action :
const url = 'auth/token';
//Headers
const httpOptions = {
headers: new HttpHeaders({
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'DELETE, POST, GET, OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With',
'Access-Control-Allow-Credentials': 'true',
'Content-Type': 'application/json',
})
};
//Query params d'un user
params = ....
return this.http.get<string>(url, {headers: httpOptions.headers, params: params }).pipe(
tap((token: string) => {
this.jwtToken.next({
isAuthenticated: true,
token: token,
});
localStorage.setItem('jwt', token);
})
);
}
But i have error 404 : i don't understand why.
GEThttp://localhost:4200/auth/token
[HTTP/1.1 404 Not Found 4ms]