Google Groups

Re: Google OAuth2 with node.js and Apache mod_proxy


Morten Hekkvang Apr 11, 2012 4:43 AM
Posted in group: Developer Forum for Google API Access using OAuth2
That is more likely to be a server setup error, than an oauth2 error.
Log your node.js setup and check how the request is received by your node.js server.
There is actually nothing very oauth-specific about the callback made.
I guess this might be some kind of error caused by url rewrites or the "?code=somereturncode" get parameter.
Another thing that might cause error is if the code contains invalid characters for your web-server setup.

br,
morten

On Apr 11, 2012, at 12:54 PM, Patrick wrote:

> I set up an Apache VirtualHost to proxy my node.js App:
>
>     <VirtualHost *:80>
>         ServerName server.domain.com
>         ServerAdmin admin example.com
>         CustomLog /var/log/apache2/access_log combinedvhost
>         ErrorLog /var/log/apache2/error_log
>
>         ProxyPass / http://127.0.0.1:3000/
>         ProxyPassReverse / http://127.0.0.1:3000/
>         <Proxy *>
>                 Order deny,allow
>                 Allow from all
>         </Proxy>
>     </VirtualHost>
>
> When trying to log in via Google OAuth with passport.js I get a 502 error after the redirect:
>
>     http://server.domain.com/auth/google/callback?code=somereturncode
>
> 502:
>
>     Proxy Error
>    
>     The proxy server received an invalid response from an upstream server.
>     The proxy server could not handle the request GET /auth/google/callback.
>    
>     Reason: Error reading from remote server
>    
>     Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8r DAV/2 Server at server.domain.com Port 80
>
> Why? Everything works perfect if I run it from my development machine on localhost.