Why are some iOS devices sending OPTIONS requests with Origin: null? - ios

On a website I'm working on, we're seeing quite a few OPTIONS requests from iOS devices that look like CORS preflight checks, but which have Origin: null. Does anyone know what might be causing such requests to be sent with Origin: null rather than the correct origin?
The user agents that I've seen exhibiting this behaviour are:
Mozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9B206
Mozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3
Mozilla/5.0 (iPod; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9B206
Mozilla/5.0 (iPad; CPU OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3
Mozilla/5.0 (iPod; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B176 Safari/7534.48.3
Mozilla/5.0 (iPhone; CPU iPhone OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.3
Mozilla/5.0 (iPad; CPU OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.3
In practice, it's not a problem to deal with these requests (just refuse them), but I'm curious to know if there's some particular set of circumstances that is causing this. The only situation I've seen described where the Origin header might be set to null is when the origin is a file:/// URL, and that seems very unlikely - the referer in each of these cases looks like a normal page view of the site.

This question is related but this blog post explains the problem and solution.
If you’ve seen this behavior in your application, you should be able to fix it by using “Content-Disposition: inline” and not “Content-Disposition: attachment”.

Related

Strange Tailing Number in the User-agent from iOS devices

Mozilla/5.0 (iPhone; CPU iPhone OS 15_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 (1234567890)
What does the the tailing number (1234567890) in the above user-agent mean? Is it something that can be used to track someone?
I have compared it with a user-agent from Safari which look like something as follows:
Mozilla/5.0 (iPhone; CPU iPhone OS 15_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.1 Mobile/15E148 Safari/604.1
The tailing number "(1234567890)" is replaced by "Safari/604.1". I suspect (1234567890) means the id of some iOS app but I have no evidence.

jitsi not supported in IOS xamarin webview

I am trying to open jitsi website on a webview,
if I open it in the Safari builtin browser, it works fine.
if I open it in a Webview inside Xamarin application, it said "It looks like you're using a browser we don't fully support"
is not it supposed the Webview uses Safari by default?
then, why Safari works, while the Webview is not supported?
Is there any work around to open the Jitsi inside the application Webview?
Opening an external browser is not an option,
------------ UPDATE (1) -----------------
According to Jason advice, I set the UserAgent:
1- I used my xamarin webview and navigate to:
whatsmyua.info
My UserAgent was "Mozilla/5.0 (iPhone; CPU iPhone OS 15_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
2- I used iPhone Safari and navigate to:
whatsmyua.info
My UserAgent was "Mozilla/5.0 (iPhone; CPU iPhone OS 15_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Mobile/15E148 Safari/604.1"
3- So I set the xamarin webview UserAgent in code behind
wkWebView.CustomUserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 15_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Mobile/15E148 Safari/604.1";
4- I check again using "whatsmyua.info", and everythign is ok, UserAgent successfully changed.
5- I tried to open "jitsi website", but nothing changed,
still gives me "It looks like you're using a browser we don't fully support"
Any Ideas, please?
===================== Update (2) ========================
I used UserAgent "Mozilla/5.0 (X11; Linux i586; rv:31.0) Gecko/20100101 Firefox/31.0",
Now it is working,
But I do not why it did not work when I used the same UserAgent like Safari!
Anyway, I am happy
Thanks (Jason)
According to Jason advice, I set the UserAgent:
1- I used my xamarin webview and navigate to:
whatsmyua.info
My UserAgent was "Mozilla/5.0 (iPhone; CPU iPhone OS 15_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
2- I used iPhone Safari and navigate to:
whatsmyua.info
My UserAgent was "Mozilla/5.0 (iPhone; CPU iPhone OS 15_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Mobile/15E148 Safari/604.1"
3- So I set the xamarin webview UserAgent in code behind wkWebView.CustomUserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 15_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Mobile/15E148 Safari/604.1";
4- I check again using "whatsmyua.info", and everythign is ok, UserAgent successfully changed.
5- I tried to open "jitsi website", but nothing changed, still gives me "It looks like you're using a browser we don't fully support"
===================== Final Working Solution ========================
I used this UserAgent:
wkWebView.CustomUserAgent = "Mozilla/5.0 (X11; Linux i586; rv:31.0) Gecko/20100101 Firefox/31.0";
Now it is working!
Anyway, I am happy
Thanks (Jason)

How does iPad OS determine what is a desktop site in iOS 13 safari

In WWDC 2019 this year Apple stated that safari on the iPad will render a site in desktop. Is there any information or does anyone know how this will work?
As far as I know this will be based on user agents.
iPads will start identifying themselves as Macs
From this….
Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us)
AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314
Safari/531.21.10
To this…
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15
(KHTML, like Gecko) Version/13.0 Safari/605.1.15

HTTP user-agent of iOS SocialUIService?

When using the native iOS share dialog UIActivityViewController inside you own App and starting to share a link via the Facebook icon a SocialUIService is in the background crawling the link/website for additional information.
What HTTP user-agent has this SocialUIService service?
From what I can tell, when the SocialUIService fetches the link in the background, the user agent is:
Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12B440
Where if you were to click on the link in Safari, it would look like this:
Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B440 Safari/600.1.4
Notice the two missing pieces are Version/8.0 and Safari/600.1.4

What is the iPad user agent?

From what I gather, the iPad is using iPhone OS, but with a different screen resolution from the iPhone and iPod touch. So many sites may have to change their user agent detection to adapt to the iPad.
So, can anyone with access to the iPad or the iPad SDK give us the user-agent string?
Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10
(almost 10 years later...)
From iOS 13 the iPad's user agent has changed to Mac OS, for example:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Safari/605.1.15
From the simulator, in iPad mode:
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9 (this is for 3.2 beta 1)
Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10 (this is for 3.2 beta 3)
and in iPhone mode:
Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.20 (KHTML, like Gecko) Mobile/7B298g
I don't know how reliable the simulator is, but it seems you can't detect whether the device is iPad just from the user-agent string.
(Note: I'm on Snow Leopard which the User Agent string for Safari is
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-us) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10
)
From a real device:
Mozilla/5.0 (iPad; U; CPU OS OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B367 Safari/531.21.10
It's worth noting that when running in web-app mode (using the apple-mobile-web-app-capable meta tag) the user agent changes from:
Mozilla/5.0 (iPad; U; CPU OS 3_2_1
like Mac OS X; en-us)
AppleWebKit/531.21.10 (KHTML, like
Gecko) Version/4.0.4 Mobile/7B405
Safari/531.21.10
to:
Mozilla/5.0 (iPad; U; CPU OS 3_2_1
like Mac OS X; en-us)
AppleWebKit/531.21.10 (KHTML, like
Gecko) Mobile/7B405
iPad 2 under 4.3.5:
Mozilla/5.0 (iPad; U; CPU OS 4_3_5 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8L1 Safari/6533.18.5
Mine says:
Mozilla/5.0 (iPad; U; CPU OS 4_3 like Mac OS X; da-dk) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8F190 Safari/6533.18.5
Here you go!
Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10
It seems to be general consensus that every mobile apple device, iphone, ipad, or ipod uses a user agent that contains both 'Mobile' and 'Safari'.
However, using the latest SDK (4.0.1) and reading the user agent on my rails server (using request.env["HTTP_USER_AGENT"]), we never get the 'Safari' part.
No matter whether the request is being made from the simulator or a real device, debug or release, it always looks something like this:
Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; de-de)
AppleWebKit/528.18 (KHTML, like Gecko) Mobile/7D11"
Just no 'Safari'. :-( So we have to use the 'iPhone' part to be sure. That is something apple does not recommend doing.
From iOS 13, can not find 'iPad', i use this js current-device, it work.
this core:
const iPadOS13Up = navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1
https://github.com/matthewhudson/current-device/blob/master/src/index.js#L55
you can see you die type : http://matthewhudson.github.io/current-device/
From Simulator 3.2 final:
Mozilla/5.0 (iPad; U; CPU OS 3_2 like
Mac OS X; en-us) AppleWebKit/531.21.10
(KHTML, like Gecko) Version/4.0.4
Mobile/7B367 Safari/531.21.10
Safari on iPad user agent string in iPhone OS 3.2 SDK beta 3:
Mozilla/5.0 (iPad; U; CPU OS 3_2 like
Mac OS X; en-us) AppleWebKit/531.21.10
(KHTML, like Gecko) Version/4.0.4
Mobile/7B334b Safari/531.21.10
More info:
http://developer.apple.com/library/safari/#technotes/tn2010/tn2262/_index.html
I think it is worth mentioning that you don't generally need to use the whole agent string, unless perhaps you find a reason where you need to tailor the website to a specific model.
You can check for iPhone, iPad and iPod in the agent string and cover all your bases.
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
appleMobileDevice = true;
}
else {
appleMobileDevice = false;
}
Since Apple VERY HELPFULLY changed their userAgent strings in iOS, you can't use a regex for ipad/iphone reliably anymore.
I suggest a combo of a regex for older and current iOS versions (/i(?:pad|phone)|mac os/i) with and additional check for navigator.maxTouchPoints. maxTouchPoints will always be 0 on a Macbook, but greater than 0 on an iPad, iPhone (usually 5).
If you further need to differentiate between iPad and iPhone, you can work with window.outerWidth and window.outerHeight to get the viewport size and orientation. This will only help so much as some of the larger iPhones have viewports that are larger than the smallest iPads.
THANKS, Apple!
For iPad Only
Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10

Resources