I am trying to make a Call by the org.springframework.web.client.RestClient.
The address/resource does definetly exist GET http://localhost:8080/someResource.
It is retrievable by simple call in the browser or via curl.
Using the RestClient returns a 404 - not found. Why is it that way. What do I have to tweak to get a 200 success answer?
final var restClient = RestClient.create(); String result = restClient.get() .uri("http://localhost:8080/someResource") .header("User-Agent", "Mozilla/5.0") .accept( MediaType.ALL ) .retrieve() .body(String.class); Also the IntelliJ's http tooling (https://www.jetbrains.com/help/idea/http-client-in-product-code-editor.html) also does return a 404.
Strange to say, e.g. a request with RestClient to https://google.com does properly work.
I build an even more simplified example on github which does not work, see test class test.Tester: https://github.com/greyshine/springboot-simple-http-call
Is there a special minimal set of headers needed or anything else?
A call on the browser does work.
A call via curl localhost:8080/test-get does work.
A call via RESTer Chrome extension does work.