lucasferreira / react-native-webview-android

Simple React Native Android module to use Android's WebView inside your app
355 stars 158 forks source link

Potential problem with redirect #46

Closed timofischer81 closed 8 years ago

timofischer81 commented 8 years ago

This seems like a react specific bug to me, but I have no idea how to debug it. Here is what I am trying to do, any advice is highly appreciated: I follow this link to a simple energy comparison website:

http://www.verivox.de/energy/msp?gc=true&cmpc=1723&cmpt=506645&existing=false&regional=false&Source_ID=1707&PLZ=10437&ranking=1&Site_ID=2&Tariff_ID=521574&usage=976&profile=H0&switch=2&ori=qwYAAAAACWFiY2UxMDQzN9ADAAACaDAAAQABAf----8BAQALAAAAFbsHAAABAAAAAAAAAAAAAAAAAACA----------8AAP--AQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAi0x-----wAAAAAAAAAAAAI%3d

The page loads and entering the checkout process by clicking the button works. But if I fill in data and want to go to the second checkout step (posting the data) I get to a 404 page. If I do exactly the same in Chrome (or "Internet") on the same smartphone I get to the next checkout step (I see from developer tools here that there is a 302 after posting the data). Does not work either using Webview or WebViewAndroid module, so the issue seems to be react specific. Any ideas how to debug this? With chrome::inspect I cannot see network request while the app loads so I have no clue what is going on or how to fix or work around this.

I posted some more details here: https://github.com/facebook/react-native/issues/5211#issuecomment-222902084

lucasferreira commented 8 years ago

Hi @timofischer81

I've understood your issue, and I will try to help you.

Following this StackOverflow post http://stackoverflow.com/a/4066497 I implemented a new prop in WebViewAndroid called allowUrlRedirect.

If what are related in SO answer are correct, this may help you:

        <WebViewAndroid
          ref="webViewAndroidSample"
          allowUrlRedirect={true} // <-- this new prop, can you test using 'true'?
          url={SITE_URL}
          style={styles.containerWebView} />

So, can you update the module to latest version and test this new prop?

timofischer81 commented 8 years ago

Thanks @lucasferreira. Unfortunately, after updating to the latest version and setting the new prop I still get the 404 page and not the next checkout page. (the only way I get this to work in my app right now is to use the react-native-webview-crosswalk module)

lucasferreira commented 8 years ago

Hi @timofischer81,

I've made a little PHP app that work with a lots of "redirects" just to test this issue.

That is the address: http://master-redirect-php.appspot.com/ And if you want to see the code: https://gist.github.com/lucasferreira/4eee80297aac928de037fadae6b4b5e4

This app works very well with WebViewAndroid, all the redirect are followed and opens OK inside the webview.

So I think that could exists some problem in your link (verivox.de). Are you the webmaster/developer of this website? Do you know what kind of redirect techniques are they using?

If you want to see my RN test sample: https://gist.github.com/lucasferreira/fce7added9f585a4ffb139daa70ed255

timofischer81 commented 8 years ago

No I am not the developer of this site and I agree they are probably doing somezhing unusual. However their site works in every browser except the react native webviews. I only got to a product manager of them and he assumed some security or cookie problems. I do not know how to debug this though.

unicornRainbows commented 7 years ago

https://github.com/facebook/react-native/issues/9201