Reputation: 266
When introducing a wildcard into my proxy.conf.js routing no longer works.
const PROXY_CONFIG = [
{
context: [
"/fi/ameribor/*"
],
target: "http://localhost:10000",
secure: false,
changeOrigin: true
}
]
module.exports = PROXY_CONFIG;
the get method is as follows:
getAmeriborRates(term:string, start:string, end:string):Observable<Rate[]>{
let queryParams = new HttpParams()
.set('Term', term)
.set('Start', start)
.set('End', end);
console.log(queryParams.toString());
return this.http.get<Rate[]>('/fi/ameribor');
//return this.http.get<Rate[]>('/fi/ameribor', {params:queryParams});
}
Everything works fine when the context is set to "fi/ameribor" but I get a bad request when using a wildcard because the redirection to my API url only seems to work when there is an exact match:
HttpErrorResponse {headers: HttpHeaders, status: 404, statusText: 'Not Found', url: 'http://localhost:4200/fi/ameribor', ok: false, …}
Upvotes: 1
Views: 261
Reputation: 77
The way you wrote context
, the routing will match any path starting with /fi/ameribor/
, but you're looking for path /fi/ameribor
. There's a "/" missing at the end
Upvotes: 0