Avoiding redirect server's url to www for specific url path

87 views Asked by At

I want to enable auto-verification of deep links in Android for which I need to host the file assetlinks.json on my server https://mycompany.com. This will allow auto-verification of my deep links when the app is installed. The problem is, we have redirect setup such that all requests from https://mycompany.com go to https://www.mycompany.com. As a result, when I put the file in the .well-known folder, it gets hosted on https://www.mycompany.com/.well-known/assetlinks.json which does not satisfy the requirement for Android's domain validator.

See domain non-redirect section here https://support.google.com/google-ads/answer/10710301?sjid=18198349224505489730-NA

So if I try to open the url https://mycompany.com/.well-known/assetlinks.json it gets redirected to https://www.mycompany.com/.well-known/assetlinks.json and the file shows up in the broswer, so opening the url in browser is not a good test. Rather, I can use curl command in the terminal to find out whats going wrong.

curl https://www.mycompany.com/.well-known/assetlinks.json will return with contents of the file but curl https://mycompany.com/.well-known/assetlinks.json will not.

I am seeing other companies being able to do that like say, Lyft.

When we execute the command curl https://lyft.com/.well-known/assetlinks.json in terminal, you can see they host the file correctly on their server without the www regardless of having a redirect in place for other url links, so if we put https://lyft.com it is still getting redirected to https://www.lyft.com correctly.

How do we acheive this? How can we keep the redirect and still put an exception for one such url path that has assetlinks.json in the end?

0

There are 0 answers