"Redirecting you back to the application" never finishes redirecting



Hi all,

For some reason, when I host my application on AWS or Heroku, the “Sign in with Twitter” button never redirects back to my webpage. This is strange, because it DOES redirect when I run the website in localhost. In other words, everything works fine when I deploy the WAR file in localhost, but the application messes up by not redirecting on AWS. To see the error, see my application: http://sample-env.vzqeyzumtm.us-west-2.elasticbeanstalk.com/

I am using Twitter4j with a Tomcat server.

Can anyone help? Thanks.


Still need help.


It’s correctly redirecting back to your application which is then throwing an error. Check your Lambda logs/configuration.

This is where it redirect to and the error response.

<title>502 Proxy Error</title>
<h1>Proxy Error</h1>
<p>The proxy server received an invalid
response from an upstream server.<br />
The proxy server could not handle the request <em><a href="/callback">GET&nbsp;/callback</a></em>.<p>
Reason: <strong>Error reading from remote server</strong></p></p>


You were right, thanks. The problem wasn’t that it wasn’t redirecting. Rather, the problem was that there was an exception when I tried to write the user’s credentials to my DB. Solved.