react-native-webview: is there a way to determine when we are done redirecting (with multiple redirections)? - react-native

Using react-native-webview, I redirect my users to an URL that will redirect to other URLs that will all redirect, multiple times.
I don't know how many redirections there are, or even the end-URL.
Is there a way to know when the webview is done redirecting?

You could send a message from the end-URL to your server when the client lands on it, which idicates that the website is done redirecting. If you don't own the URLs where your client gets redirected to, you must know how many times the client gets redirected, so you can calculate a time-astimate with the default ping of the client plus a buffer...
Something like that: done_redirecting = avg_ping * redirecting_amount + buffer
Please note that this is pseudo-code and theoretical.

Related

Can I use vb.net to interrogate a website to know if it uses SSL

I have a program that asks the user to type in a URL, and click download. Then the program downloads the webpage.
However, some websites use SSL, and in that case the user has to prefix his URL with https:// for this to work.
The problem is that the user may not know whether the website uses SSL, and may type http://... instead of https://....
Is there some way to send a preliminary message to the website (from vb.net) asking whether the URL should start with https or just http? If there is, I can correct the user URL before attempting to retrieve the web page.
(I should say there it is not enough to use something like this:
request.RequestUri.Scheme - this looks at the URL the user submitted, not the URL coming back from the server, as far as I know)
For websites that uses SSL, usually they will force the request to use HTTPS. That is when you send a request in HTTP, for example, http://www.example.com, the website will send a redirect response with HTTP status code 302 as well as the URL the client side that initiate the request should redirect user to.
So, you can try HTTP first and check the response to see if there is a redirect. So, you will need to handle that in your code.

How to hide part of a URL from clients using htaccess?

I'm working on a website running on an Apache server. The PHP factory makes and takes URLs that look like this:
site.com/page/view/[id]/[vanity-url]
However, the client wants to hide part of the URL from view, so in the browser it appears as:
site.com/[vanity-url]
The server still needs to see the full URL.
I've tried various RewriteRules after hours of searching, and the closest I seem to have come is:
RewriteRule ^page/view/(.*)/(.*)$ /$2 [R,L]
...but that doesn't seem to be doing anything. I know for sure that my .htacces is working.
What am I doing wrong?
Unfortunately, this isn't possible. Let me explain why:
You state that the server needs to see the full URL. Specifically, this includes the id segment, which I am sure your framework needs (it wouln't need it if the server only needs to see the vanity segment). The code you have provided redirects the full URL to the vanity URL, thus making the full URL invisible to the server for the next request.
So, navigating to /page/view/2/about-us would redirect to /about-us, and the address bar would change to reflect that. This causes a new request to be sent to the server, containing only the /about-us vanity URL.
As a result, you would need to rewrite the vanity URL back to the full URL (without redirecting, so that the /about-us stays in the address bar as-is), but you wouldn't be able to do this, as the vanity URL does not contain the id segment, which seems to be a requirement for the framework to serve the correct response. Keep in mind that Apache cannot guess the ID for that particular vanity URL.

url subdomain wildcard redirect

I read some of the answers related to the topic but my situation is a little different. I'm hosted on GoDaddy shared Linux hosting. Currently my application is setup to handle uri's as follows:
https://state.domain.com/region/client/xyz/function1
I want to change the application so the new url will be as follows. The change has been implemented and working for new clients but for my existing clients I want to this to be seamless without having them to update the url they are using to access the application. The new url would be:
https://country.domain.com/state/region/client/xyz/function1
We have quite a few clients that are using the application and I was wondering if we can use wildcards to create generic redirection. What would be the best way to achieve this?
I was reading subdomain redirection through htaccess but in my case I need the generic redirection to give me the complete uri so for example in the above case the redirected uri should be exactly as specified above. In another case if the incoming request is for
.../region/client/xyz/function2
It should be redirected to
.../state/region/client/xyz/function2
Any help would be really appreciated

While Redirecting the url through apache server Data get lost

My Question is this
I redirect the form in
Redirect /formviewer/faces/pages/view/viewform.xhtml
///formviewer/faces/pages/view/viewform.xhtml
in Apache Http Server but the form is not redirecting while doing post request from client Side.
So what is it doing?
I rather suspect that its normalising the thing you want to redirect to ///... and considering it the same.
When looking at redirects, there are three things in my list of 'go-to' tools:
curl -I http://..... and look at the response and the Location header. I use this when installing new redirects (it avoids following chained redirects and gives me a better view of what is happening at each step.
Something like Fiddler or a browsers developer tool. Frankly I'd only use this if curl wasn't doing it for me.
Enable the RewriteLog in Apache... I almost never use this, but for your case it may shed some light.
But let's take a step back: why are you wanting to redirect to a path with and extra // prepended (which as I've previously speculated, likely won't work)?

redirect in .htaccess

I am trying to point www.mydomain.example/blogs to www.anotherdomain.example/blog.html and still keep the URL the same, any ideas?
I have tried so many different methods and the URL changes to the URL im am redirecting to.
Thanks
Unless both domains are hosted on the same server and you have access via the file system, you will probably need a proxy on mydomain.example that forwards the requests to anotherdomain.example, fetched the response and forwards it back to the client.