fuechsle
fuechsle

Reputation: 225

Angular Frontend and proxy to wildlfy rest service

I have an angular frontend that uses rest services provided by wildfly. To call the wildfly from angular I installed a proxy using this informations: angular-cli server - how to proxy API requests to another server?

When I now call the service from my angular app, I get the following error in wildfly. javax.ws.rs.NotFoundException: Could not find resource for full path: http://localhost:8080/whatever/rest/entity

Calling the url in the browser works fine.

Any Ideas?

Upvotes: 1

Views: 300

Answers (2)

fuechsle
fuechsle

Reputation: 225

Now I found the solution:

proxy.config.json

{
   "/**api**": {
      "target": "http://localhost:8080/whatever/rest",
      "secure": false,
      "changeOrigin": true
   }
}

this way the proxy forwards you to http://localhost:8080/whatever/rest/api/entity

I thought api isn't regarded.

So I changed it like this:

{
   "/**rest**": {
      "target": "http://localhost:8080/whatever/",
      "secure": false,
      "changeOrigin": true
   }
}

and it worked. The url http://localhost:8080/whatever/rest/entity is reachable

Upvotes: 1

Joseph Kirega
Joseph Kirega

Reputation: 3

Just a suggestion, it could be that your missing a trailing slash at the end.

Upvotes: 0

Related Questions