Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

219
Views
Spring Social: redirect url when server behind proxy

In my Spring Boot app I have implemented login using Spring Social (1.1.4.RELEASE) (Facebook, Google, LinkedIn and Twitter).

During the login process the server calls the following HTTP GET:

https://accounts.google.com/o/oauth2/auth?client_id=XXX&response_type=code&redirect_uri=http://xzy.com:91/auth/google&scope=email&state=YYY

Problem is here: redirect_uri=http://xzy.com:91/auth/google

The app in behind the proxy and I need to change the redirect_uri to

http://xzy.com:91/auth/google -> http://xzy.com/auth/google

I guess this is pretty common problem, but I wasn't able to find working solution (

my pom:

    <dependency>
        <groupId>org.springframework.social</groupId>
        <artifactId>spring-social-security</artifactId>
        <version>${spring-social-version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.social</groupId>
        <artifactId>spring-social-linkedin</artifactId>
        <version>${spring-social-linkedin.version}</version>
    </dependency>


    <dependency>
        <groupId>org.springframework.social</groupId>
        <artifactId>spring-social-twitter</artifactId>
        <version>${spring-social-twitter.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.social</groupId>
        <artifactId>spring-social-google</artifactId>
        <version>${spring-social-google.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.social</groupId>
        <artifactId>spring-social-facebook</artifactId>
        <version>${spring-social-facebook.version}</version>
    </dependency>
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

@Bean
public ProviderSignInController providerSignInController(ConnectionFactoryLocator connectionFactoryLocator, UsersConnectionRepository usersConnectionRepository) {
    ProviderSignInController controller = new ProviderSignInController(connectionFactoryLocator, usersConnectionRepository, new SimpleSignInAdapter());
    // get the url from config, this just for example
    controller.setApplicationUrl("http://xzy.com");
    return controller;
}

As you can read from the code in spring-social, the application url will replace the base url.

protected String callbackUrl(NativeWebRequest request) {
        if (callbackUrl != null) {
            return callbackUrl;
        }
        HttpServletRequest nativeRequest = request.getNativeRequest(HttpServletRequest.class);
        if (applicationUrl != null) {
            return applicationUrl + connectPath(nativeRequest);
        } else {
            return nativeRequest.getRequestURL().toString();
        }
    }
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!