1

I'm working on an app that uses the Feign client to call another service. The problem now is I keep getting a 301 thrown as an Exception. How do I propagate this to ignore 301 as an error and fetch the actual response from the service?

This is the client interface for the service I am trying to call.

package com.eventmanager.events.client;

import com.eventmanager.events.client.mappings.Auth;
import com.eventmanager.events.responses.Response;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;

@FeignClient(value = "auth-service")
public interface AuthClient {
  @GetMapping("/api/v1/auth")
  public Response<Auth> getLoggedUser(@RequestHeader(value = "Authorization") String authorization);
}

1 Answers1

0

I think this means that your destination server has redirected you, so if you wanna some code except 301 or 302, It's better to change your server code.

Similar scenario:

In spring security when the authentication process is failed, it sends client 302 code(It redirects client), but the client needs exact 403 or 401 codes, so we need to change server code to not redirect client but send exact code.

  • I've looked up every implementation for this and none scales better. The server is meant to actually respond with a 200. It responds with a 200 locally and otherwise on the cloud platform. – King Einsteinet Jan 12 '20 at 13:56