OAuth2 Redirect causing Error 97

Hi All,

I'm evaluating a trial copy of Rstudio Connect this weekend. So far it's going well, but I'm left with an annoying error. It's set up behind an nginx proxy using Google OAuth2. Everything works fine, except that as the Google OAuth2 interface redirects back to Rstudio Connect I get:

{"code":97,"error":"Changing host or scheme in redirect is forbidden.","payload":null}

If I then refresh the page I'm authenticated as expected. I'm struggling to work out where to look next to troubleshoot this.

Google OAuth2 setup seems to be OK, with the redirect uri:

https://my.frontend.com:443/__login__/callback 

and the origin uri:

https://my.frontend.com:443

(I've tried with & without the port)

My nginx config seems to be as per the manual, except it forces https. Here's something similar to a minimum failing example:

map $http_upgrade $connection_upgrade {
          default upgrade;
          ''              close;
}

server  {
           listen                           80;
           listen                           [::]:80;
           server_name                      my.frontend.com;
           return              301          https://$host$request_uri;
}

server {
           listen                           443 ssl http2;
           listen                           [::]:443 ssl http2;
           server_name                      my.frontend.com;
           ssl   on;
           ssl_certificate                  fullchain.cer;
           ssl_certificate_key              tls.key;

           client_max_body_size 0;
           
           location / {
                      proxy_pass            https://my.backend.com:443;

                      proxy_set_header      X-RSC-Request    $scheme://$host:$server_port$request_uri;
                      proxy_set_header Upgrade $http_upgrade;
                      proxy_set_header Connection $connection_upgrade;
                      proxy_http_version 1.1;
                      proxy_buffering off; 
           }
}

Any ideas on where I should be looking to try to track this one down?

Thanks

An update on this - I hadn't realised that I was eligible for Connect Support while on a trial.

I submitted a support ticket, but in that process I had to check the installed version. It turns out that following the auto-emailed installation instructions had created an out of date version - v1.8.4.

Updating to the latest version (1.8.8) solved the above error, though it was useful to be able to send diagnostics to the support team & to have them respond that it should be fine - I initially couldn't log in at all after updating - a problem which solved itself after 24hr, presumably because of caching.

1 Like

Thanks for updating on this @sturu! And welcome to RStudio Community!! I'm glad you were able to make it to the support team! In an ideal world, one of us would have commented here (in a bit more timely fashion) and pointed you to support :grinning_face_with_smiling_eyes:

Also, if you encounter errors like that with caching again, clearing cookies or trying in an incognito window / different browser can occasionally resolve. Please let us know if you run into any other issues!! I hope the trial goes well!! Please let us know if you have questions or feedback!

Also:

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.