I have a simple NodeJS server set up, serving basic static files (slide show basically), so an index.html with some *.js files included via <script...> and yadda yadda, that's a bit beside the point I think. I check the server host's IP as part of server start, and it is, for example, 192.168.1.10 with my server running on port 8080. When I visit http://192.168.1.10:8080/index.html from a laptop, it works exactly as expected. When I visit from my iPhone, I get NSURLErrorDomain with no other helpful information. The server itself logs all HTTP requests (successful or otherwise), and logs correctly for requests from laptops, but logs no request attempts at all when trying from iOS. I tried using port 80 to be more standard, but this results in the same error. How can I make it so that my stock basic out-of-the-box iPhone can visit a basic NodeJS server running nothing more complex than createServer(... with require('http')?
First, there should be a error code alongside with the NSURLErrorDomain; you can then check NSURLErrorDomain error codes description
for more information.
I would guess it has something to do with transport security.
You should either try to use the HTTPS secure protocol, or allow arbitrary loads by editing the Info.plist file:
Information Property List -> App Transport Security Settings -> Allow Arbitrary Loads = YES
or, if you prefer xml:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
</dict>
Related
Update: This is specific to Firefox. This does not occur using Chrome. I will leave the text below as is, but now the main question is, how and what in Firefox is causing this. It occurs regardless of cookie settings, such as allowing third-party cookies and trackers.
Preface: I've searched and read dozens of pages trying to resolve this issue I've gone through all the troubleshooting steps in the AWS documentation, eg,
https://docs.aws.amazon.com/cloud9/latest/user-guide/app-preview.html#app-preview-share
and this thread:
https://forums.aws.amazon.com/message.jspa?messageID=849200 as well as resources on stackoverflow
and the c9 forums
https://community.c9.io/t/what-is-vfs-connection-does-not-exist-on-aws-c9/22697/4)
I am trying to preview a running rails app from the Cloud 9 IDE. When I run the app using rails server, there are no error messages indicating anything wrong. The output shows Started GET '/' for [my home IP] ...... 200 Completed OK.
Console Output:
Trying to preview the running app only produces a "OOPS VFS connection does not exist" screen. The preview url is always https://[user_generated_sequence].vfs.cloud9.[region].amazonaws.com/ All TCP traffic is allowed as per the rules set up by following the troubleshooting guides.
OOPS error message page:
The same issue occurs whether using puma or WEBrick. With WEBrick, a popup for the preview link appears, but leads to the same error message page. With puma, the running app is listening on tcp://[localhost/0.0.0.0]:[8080 or 3000]. With WEBrick, it listens instead on http://localhost:8080.
I have followed the instructions exactly in the rails tutorial to set up a simple app. Everything in the code itself should be fine. How can I get this to work correctly? I'm very confused and about to give up on rails.
I recently had the same issues after updating Firefox because cross-site cookies are required to preview a running rails application. If, like me, you have disabled that in Firefox as part of strict Enhanced Tracking Protection, they will need to be enabled at least for this specific site.
Make sure you are accessing the preview from the same browser:
This URL works only when the IDE for the environment is open and the
application is running in the same web browser
https://docs.aws.amazon.com/cloud9/latest/user-guide/app-preview.html#app-preview-preview-app
Something that worked for me, do the following:
run:
rails s
the in the AWS EDE click on 'Preview' and 'Select Running Application'
Once it will open click on the button/link and it should open in another window with the running application.
Note: Doing this manually by copying the URL link and pasting in another tab did not work for me.
Try disable Ad Blockers and privacy Extention. It worked for me.
Basically you need to allow third party cookies
in chrome it's
Settings >> Security >> Cookies and web data >> Choose second option(block cookies only in incognito)
That works for me
On cloud9, click the shield logo in the address bar and switch "Enhanced Tracking Protection" to be off. Then refresh the page and the preview.
I was struggling with this as well. Finally, I changed the cookie setting from all third-party cookies to cookies from unvisited sites (See image)
Cookie Settings for Firefox
In our project we want to make sure that the data communicating with the sever always transfer through the https.
As a tester, I want to test this work as expected. How do I test that in client side.
thanks
Just change the Info.plist temporarily.
Info.plist -> Open As -> Source Code: NSAppTransportSecurity, NSAllowsArbitraryLoads = NO.
So the client http is forbidden.
After the test, reset as before.
In the app I'm working on, I need to handle 3-D Secure redirects from our payment service provider. These redirects point to a web page of the card issuer that is shown in a WKWebView to the user in the app.
This works all the time except one case where the WKWebView doesn't load for https://3dsecure.csas.cz/ and fails with the following error:
Error Domain=NSURLErrorDomain
Code=-1200
"An SSL error has occurred and a secure connection to the server cannot be made."
What's interesting is that the same URL loads with no problems in Safari or in SFSafariViewController. Even the server's certificate is okay:
I've tried to play around with NSAppTransportSecurity settings in app's Info.plist file, specifically enable NSAllowsArbitraryLoadsInWebContent and NSAllowsArbitraryLoads but it does have no effect.
Forward Secrecy
It turns out that the server for 3dsecure.csas.cz does not support Forward Secrecy: https://www.ssllabs.com/ssltest/analyze.html?d=3dsecure.csas.cz&s=194.50.240.77
Perfect forward secrecy is required by App Transport Security in iOS9 and above for all app connections, including webviews (not including Safari, however)
ATS Debugging
Running the following command in Terminal runs ATS diagnostics and tells more about the problem and how to solve it:
/usr/bin/nscurl --ats-diagnostics --verbose https://3dsecure.csas.cz
ATS Exception in the app
Allowing the webview in the app to connect to a specific server that does not support forward secrecy could be done by adding the following in the Info.plist file:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>3dsecure.csas.cz</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
Not future-proof
This exception needs to be added for every single domain that does not support forward secrecy. Unfortunately, It's impossible to know all the 3-d secure servers in advance as they come as redirects from the payment provider.
What I don't know is if not requiring forward secrecy could be set for any domain, globally, and just within a specific webview, without affecting the whole app.
This question already has answers here:
How do I load an HTTP URL with App Transport Security enabled in iOS 9? [duplicate]
(8 answers)
Closed 7 years ago.
The following code works fine before iOS8.4.1 (includ 8.4.1). While it ruturns nil in iOS9.0.1. Is it a bug or there is a public annoucement for this change? I tested with two iPads.
let url = NSURL(string: "http://www.mapshots.com/wp-content/uploads/2014/05/mapshots-ag-studio-agricultural-mapping-software-logo.png")
let data = NSData(contentsOfURL: url!)
NSLog("Data length #%", (data?.length)!)
This is an issue related to ATS(App Transport Security Protocol) changes made by Apple in iOS 9. By default iOS9 disregard communication with http protocol. Your URL should be https. However you can include exception for specific domains in your app or you can allow all http communication to be allowed from within your app.
Check the Documentation for full details.
To Allow all http domains from your application, you should add
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
But as Apple has recommended these new settings, you should chose to add exception for this specific domain in your app rather than allowing all http domains. Check this thread to achieve this.
With iOS 9 you can't call an HTTP anymore because the ATS (App Transport Security) calls should be HTTPS. To work with HTTP links, you should insert the following key in the info.plist file to disable the ATS:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>
create a new voice in the info.plist file "NSAppTransportSecurity" like dict.
insert in it the key "NSAllowsArbitraryLoads" like boolean and set to YES
;-)
I'm having some issues with direct update on iOS.
Following scenario describes my problem.
Add the code snippet below to main.js
Enabled worklightSettings in application-descriptor.xml
Run on Worklight Development Server
Open project in Xcode via eclipse
Run
Make a change and re-deploy
Verify Direct Update is received
Uninstall app
Obtain new IP (in my case by restarting my macbook the next day)
Open project in Xcode via eclipse
Run
Open myapp settings via Settings.app and enable Custom Server URL. The URL is pointing to the old IP.
Enable Custom Server URL and enter the correct IP
Open app
Direct Update is not received
Code snippet:
function wlCommonInit(){
WL.Client.connect({
onSuccess: onConnectSuccess,
onFailure: onConnectFailure
});
}
function onConnectSuccess() {
WL.Logger.debug("Connect success.");
}
function onConnectFailure() {
WL.Logger.debug("Connect failed.");
}
EDIT
Try following scenario:
create a new app from scratch and deploy it on your iPad
verify the custom server URL and test direct update: all is working fine (OK)
update the ip on your development machine
remove the app from the device and reinstall it
verify the custom server URL: the old IP is present (NOK)
start the app with the use custom server url unchecked => 'connect success'
start the app with the use custom server url checked (don't change ip) => 'connect success'
try to access the app in your browser with this ip => doesn't work
change the ip and remove the last front slash from the custom server url
start the app with the new correct IP (which works in the browser) => 'connect success'
change the ip back to the incorrect IP, add the slash and retry => NO 'connect success'
The exact same custom server URL which worked before fails now. When I try a random IP address I also don't get the 'connect success'.
EDIT
result of ifconfig:
When you add a project in Worklight Studio, the following warning message is outputted:
FWLPL0010W: The current server configuration is set to "localhost".
Therefore the Worklight build uses the primary IP address of this
computer (192.168.1.100) instead. It is recommended to set the server
configuration to use the fully qualified hostname or IP address of
this computer. To configure the setting, in the "Servers" view
double-click the Worklight Development Server entry and edit the "Host
name" field.
In the comments you say the wrong IP address is used, so try and change the default IP address that Worklight Studio selects by following the above instructions. The address you will set will be used as the server address, as well as be used in the application (the address that you see in the app settings page).
To make sure the settings page is fully 'refreshed':
Delete the app from the device/simulator
When opening the project in Xcode, first select Clean and then Run (because Xcode tends to keep the Settings.bundle file cached)