Spring social adds wrong Location header when authenticating behind proxy
My setup consists of 3 docker images
- Nginx
- Spring boot application
- Angular 5 application
Now when authenticating everything works fine until google authentication succeeds.
When google redirect to my page the request url is correct https://example.com/signin/google, but the Location header is http://backend-app:8080/social/signup and the browser tries to access the url in location header which fails because it's an internal url.
In configuration I set https://example.com as the application url
@Bean
public ProviderSignInController providerSignInController(ConnectionFactoryLocator connectionFactoryLocator, UsersConnectionRepository usersConnectionRepository, SignInAdapter signInAdapter) {
ProviderSignInController providerSignInController = new ProviderSignInController(connectionFactoryLocator, usersConnectionRepository, signInAdapter);
providerSignInController.setSignUpUrl("/social/signup");
providerSignInController.setApplicationUrl(environment.getProperty("application.be.url"));
return providerSignInController;
}
But somehow the Location header is still the internal url. I'm not sure whether the issue is in nginx or back-end application, but I suspect the back-end application.