Https and http Google Chrome Redirect

Four weeks ago we launched Ghacklabs and had all kinds of problems like Twitter oAuth, https redirect (when our site uses only http) – to fixing browser OAuth issues in Google Chrome, Safari and Firefox.

Imagine that you’ve created a new product – but it’s only you that can’t access it. You’re trying to sign in to your own product but nothing seems to work.

Or, it’s working on some devices and not others.

I’m not sure if you can understand what it feels like, but I can tell you this – it’s pretty damn painful not being able to use your own product. Out of any user, I had the most problems and I couldn’t seem to work out why.

This is a story about how I spent countless hours troubleshooting, and eventually fixed http/https issues, Twitter oAuth login and locale/network issues on Mac Desktop and iPad.

Trying Simple Things First

On both my Mac and my iPad I did all of the standard things like clearing cache, resetting my browsers, checking firewalls to making sure my operating system and all apps were up to date.

I even jumped on a call with my ISP to have our modem re-set and to double check that their was no firewall on the modem preventing my access.

But nothing seemed to work. I was like “oh crap” we have this cool product online and I can’t use it … That really hurts.

Leading to The ‘Aha’ Moment 

One of our users reported an issue that was similar to what I was facing – and this got me thinking …

She is a founder in Australia and was previously working in San Francisco. It’s likely that her computer or mobile may have been purchased in America.

Before moving back to Australia, I was working in Seoul. And, I bought both my Mac and iPad from Korea.

Could there be some kind of issue here because my devices were purchased from overseas? Could this be why I’m having problems accessing Ghacklabs?

I checked my computer and happened to notice that the “locale” was set up as “Korea” in my Wi-Fi interface settings. You may happen to notice two things here:

1 ) Locale: Is set as Korea.

2 ) TPG-N7RJ (Our current ISP): Is pre-configured with the country code “KR.”

Fixing Chrome Https Default Settings

However, in my Mac “General Settings,” my location was already re-registered and set up as “Australia.”

So then I thought …

Could this be some kind of “locale” or “network” issue that is for some strange reason conflicting with the Twitter OAuth login?

Troubleshooting Locale in Terminal

I tested my location status in Terminal.

Browser Bug Testing

And other things like this …

Terminal Locale

And went through a few cool locale guides on StackOverFlow trying different things in Terminal.

I discovered that my Locale settings in Terminal were set to UTF -8 which was correct.

Fixing Browser OAuth in Chrome, Firefox and Safari – Mac Desktop

I thought, this could be some kind of advanced caching issue that had saved previous information.

And for some strange reason, this was conflicting. Here’s how I fixed it on all browsers.

Mac Network Bug

I then clicked on the “Advanced” settings, which took me to this page.

Fixing International Mac Settings

And here’s how I fixed it.

I deleted all previous Wi-Fi settings that were saved (and there were a few from when I was living in Korea).

The image above doesn’t show the previous Wi-Fi connections, but there were plenty … both in Australia and in Korea.

Then, I cleared all from the list except for my current ISP using the minus (-) function.

After that, I reset my browsers and I was then able to login to Ghacklabs using Twitter on Google Chrome, Firefox and Safari. The oAuth was suddenly working.

I felt like screaming “YAY!”

Browser OAuth Issues on iPad With Twitter

Everything was fixed on my desktop. But, I still couldn’t login via the Twitter OAuth on my iPad. Nothing was working, Chrome, Safari or Firefox.

Then I thought … enough is enough. I’m going to try and work out how to fix this.

Fixing Browser OAuth in Safari and Firefox – iPad

I then spent a few hours browsing through various blog posts and tried a few things but nothing seemed to work.

I started to think about why it wasn’t working on my Mac Desktop … and tried to replicate something similar on my iPad – but that didn’t work.

I must of literally went through almost every setting on my iPad especially things like security, content settings and firewall. None of these changes worked.

Then, in “General Settings” I noticed the setting “Reset.” I thought that if my PC had issues because it was purchased in Korea, and it has to be a similar issue on my iPad.

Firefox and Safari

It was a shot in the dark.

And it worked!!!

I tested it on Safari = Working.

Then Firefox = Working.

Chrome = Not working.

Oh damn. Well 2 out of 3 is not bad but I still wanted to fix the oAuth issue on Google Chrome.

Fixing Browser OAuth in Google Chrome – iPad

When I was trying to login on FireFox and Safari, I got one error message and on Google Chrome, it showed me another.

Typing in the URL “ghacklabs.com” would redirect to https://ghacklabs.com – and because we hadn’t set up the SSL (https) yet – Google was defaulting our domain to “https” on my iPad.

Google Chrome Defaults to Https Problems and Fixes

In Google Chrome, when I would click on “Log In” with Twitter, it would redirect via “https” and wouldn’t complete the log in.

—->Error Message – _oauth/twitter/?requestTokenAndRedirect=true

Google Chrome https default bug fix

The same thing happened in Safari and Firefox but with a slightly different error message (which you can check out in the URL’s here).

Safari and Firefox OAuth Problem – iPad

Typing in the URL “www.ghacklabs.com or ghacklabs.com” would bring up the website with no issues.

However, when I click on “Log In” with Twitter, it would redirect via “https” and login but not complete the final process.

—->Error Message – _oauth/twitter?close&state=ey

Firefox, Chrome and Safari

When I used the naked domain, and signed in on Twitter – it would redirect to Twitter, login, and then redirect to “https” – failing to finish the Twitter authentication token request process.

Debugging Http and Https in Google Chrome – iPad

I noticed that there were two different browsing errors on iPad.

1 ) Safari and Firefox: http://ghacklabs.com/_oauth/twitter?close&state=ey (error)

2 ) Chrome: https://ghacklabs.com/_oauth/twitter/?requestTokenAndRedirect=true (different error)

Safari and Firefox “failed to finish the authentication process” whilst Chrome was “defaulting the authentication process to https.”

Because we haven’t set up the SSL (https) yet I know what the problem was – I just didn’t know how to solve it.

I then spent a bit of time trying to work out ‘how to configure the https/http default settings,’ in Google Chrome.

I tried a few things, and couldn’t seem to work it out “how” or “where” I could do this with something that’s up-to-date.

So, I did some digging on the web and found that Google previously allowed you to change your “https/http” settings, and for some reason Google took this feature away from Chrome.

I discovered that there was a way to manually configure this via chrome://net-internals/#hsts by adding your website URL to “delete domain.”

Fixing Http and Https Errors

I had high hopes and thought that this would fix the issue. But it didn’t.

And, I was like … Screw this, I’m just going to “delete” the Google Chrome App from my iPad and try reinstalling it.

Then it worked!!!

About Writing This Article

I’m a non-tech founder and wrote about the issues I was facing and thought this might be able to help anyone that is unlucky enough to experience the same problems I had.

I have “more than likely” worded things here completely wrong, especially breaking it all down in a technical nature.

However, I believe that any programmer reading this would be able to work out exactly went wrong and hopefully forgive any mistakes that I’ve made in describing what happened here.

On the plus side.

By a stroke of luck and determination, I managed to solve a few locale/network/cache issues on my Mac and iPad.

My final thoughts … Programmers deserve more respect as they go through shit like this all the time.

#RespectProgrammers


 

Join 100’s Of Founders and Investors Reading Our Essays.

 


  • Florian Wermelinger

    I would recommend you to investigate closer to the source of the problem. Whatever application is performing oauth requests should use the right URLs for your site. If you try to make your device work, there are probably numerous people out there who have the same problem, but they won’t invest as much time as you trying to make it work. And set up https for your site. It’s almost a must these days. And if your website uses any form of authentication, it definitely is. It got significantly easier in the last years with free certificates from Mozilla’s letsencrypt.

    • Yeh, I spent a lot of hours troubleshooting and testing a whole bunch of different things. Still not 100% sure why or what happened, but I believe that it had something to do with my PC and iPad being purchased overseas – and there was some kind of “locale” issue. I’m not a programmer, so I could be totally wrong here. On the plus side, it’s fixed 🙂