You can reproduce the authentication issue with a sample app generated by Sencha Command 3.
My model:
Code:
Ext.define('HttpsBug.model.MyModel', {
extend : 'Ext.data.Model',
config : {
fields : [{
name : 'name',
type : 'string'
}],
identifier : 'uuid'
}
});
My store:
Code:
Ext.define('HttpsBug.store.MyStore', {
extend: 'Ext.data.Store',
config: {
model: "HttpsBug.model.MyModel",
storeId: "MyStore",
proxy: {
type: 'ajax',
timeout: 2000,
url: 'dummy.json',
reader: {
type: 'json',
rootProperty: 'groups'
}
}
}
});
My Main.js:
Code:
Ext.define('HttpsBug.view.Main', {
extend: 'Ext.tab.Panel',
xtype: 'main',
requires: [
'Ext.TitleBar',
'Ext.Video'
],
config: {
tabBarPosition: 'bottom',
items: [
{
title: 'Welcome',
iconCls: 'home',
styleHtmlContent: true,
scrollable: true,
items: {
docked: 'top',
xtype: 'titlebar',
title: 'Welcome to Sencha Touch 2'
},
html: [
"You've just generated a new Sencha Touch 2 project. What you're looking at right now is the ",
"contents of <a target='_blank' href=\"app/view/Main.js\">app/view/Main.js</a> - edit that file ",
"and refresh to change what's rendered here."
].join("")
},
{
title: 'Get Started',
iconCls: 'action',
items: [
{
docked: 'top',
xtype: 'titlebar',
title: 'Getting Started'
},
{
xtype: 'video',
url: 'http://av.vimeo.com/64284/137/87347327.mp4?token=1330978144_f9b698fea38cd408d52a2393240c896c',
posterUrl: 'http://b.vimeocdn.com/ts/261/062/261062119_640.jpg'
}
]
}
]
}
});
My app.js:
Code:
//<debug>
Ext.Loader.setPath({
'Ext': 'touch/src',
'HttpsBug': 'app'
});
//</debug>
Ext.application({
name: 'HttpsBug',
requires: [
'Ext.MessageBox',
'Ext.data.identifier.Uuid'
],
views: ['Main'],
models : ['HttpsBug.model.MyModel'],
stores : ['HttpsBug.store.MyStore'],
launch: function() {
// Initialize the main view
Ext.Viewport.add(Ext.create('HttpsBug.view.Main'));
var store = Ext.getStore('MyStore');
store.load(function(records, operation, success) {
if (success) {
Ext.Msg.alert('Loaded', 'Store loaded');
}
}
);
}
});
My index.html:
Code:
<!DOCTYPE HTML>
<html manifest="" lang="en-US">
<head>
<meta charset="UTF-8">
<title>HttpsBug</title>
<!-- The line below must be kept intact for Sencha Command to build your application -->
<script id="microloader" type="text/javascript" src="touch/microloader/development.js"></script>
</head>
<body>
</body>
</html>
My app.json:
Code:
{
"name": "HttpsBug",
"indexHtmlPath": "index.html",
"url": "http://127.0.0.1:8080/HttpsBug",
"js": [
{
"path": "touch/sencha-touch.js"
},
{
"path": "app.js",
"bundle": true, /* Indicates that all class dependencies are concatenated into this file when build */
"update": "delta"
}
],
"css": [
{
"path": "resources/css/app.css",
"update": "delta"
}
],
"appCache": {
"cache": [
"index.html"
],
"network": [
"*"
],
"fallback": []
},
"resources": [
],
"ignore": [
"\.svn$"
],
"archivePath": "archive",
"buildPaths": {
"testing": "build/testing",
"production": "build/production",
"package": "build/package",
"native": "build/native"
},
"buildOptions": {
"product": "touch",
"minVersion": 3,
"debug": false,
"logger": false
},
"id": "1098ac82-556f-4f1c-9363-b43ac8c10a24"
}
To reproduce, build using the production environment:
Code:
sencha app build production
Using the standard Safari browser on iOS (reproducable both, on iOS 5.x and 6.x) open the page via a https connection using basic authentication. The resulting Apache log:
Code:
<SERVER> - - [30/Jan/2013:11:45:09 +0100] "GET /<PATH> HTTP/1.1" 401 483 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B142 Safari/8536.25"
<SERVER> - <USER> [30/Jan/2013:11:45:20 +0100] "GET /<PATH> HTTP/1.1" 301 311 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B142 Safari/8536.25"
<SERVER> - <USER> [30/Jan/2013:11:45:20 +0100] "GET /<PATH>/ HTTP/1.1" 200 5179 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B142 Safari/8536.25"
<SERVER> - <USER> [30/Jan/2013:11:45:21 +0100] "GET /<PATH>/app.json?1359542723269 HTTP/1.1" 200 290 "https://<SERVER>/<PATH>/" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B142 Safari/8536.25"
<SERVER> - <USER> [30/Jan/2013:11:45:21 +0100] "GET /<PATH>/cache.appcache HTTP/1.1" 200 94 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B142 Safari/8536.25"
<SERVER> - <USER> [30/Jan/2013:11:45:21 +0100] "GET /<PATH>/resources/css/app.css?1359542723466 HTTP/1.1" 200 212323 "https://<SERVER>/<PATH>/" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B142 Safari/8536.25"
<SERVER> - <USER> [30/Jan/2013:11:45:25 +0100] "GET /<PATH>/app.js?1359542723467 HTTP/1.1" 200 452182 "https://<SERVER>/<PATH>/" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B142 Safari/8536.25"
<SERVER> - <USER> [30/Jan/2013:11:45:26 +0100] "GET /<PATH>/index.html HTTP/1.1" 200 5179 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B142 Safari/8536.25"
<SERVER> - <USER> [30/Jan/2013:11:45:26 +0100] "GET /<PATH>/dummy.json?_dc=1359542728948&page=1&start=0&limit=25 HTTP/1.1" 200 515 "https://<SERVER>/<PATH>/" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B142 Safari/8536.25"
<SERVER> - <USER> [30/Jan/2013:11:45:26 +0100] "GET /<PATH>/app.json?1359542728959 HTTP/1.1" 200 290 "https://<SERVER>/<PATH>/" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B142 Safari/8536.25"
I substituted IP addresses, usernames and servernames. Everything works as it should, GET request, authentication, and then the requests for the files, and finally the request to the json file loaded by the store.
If you add the page to the homescreen and open it the first time, you get:
Code:
<SERVER> - - [30/Jan/2013:11:46:00 +0100] "GET /<PATH>/ HTTP/1.1" 401 483 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B142"
<SERVER> - <USER> [30/Jan/2013:11:46:09 +0100] "GET /<PATH>/ HTTP/1.1" 200 5179 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B142"
<SERVER> - <USER> [30/Jan/2013:11:46:10 +0100] "GET /<PATH>/app.json?1359542772517 HTTP/1.1" 200 290 "https://<SERVER>/<PATH>/" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B142"
<SERVER> - <USER> [30/Jan/2013:11:46:10 +0100] "GET /<PATH>/cache.appcache HTTP/1.1" 200 94 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B142"
<SERVER> - - [30/Jan/2013:11:46:10 +0100] "GET /apple-touch-icon-114x114-precomposed.png HTTP/1.1" 401 483 "-" "Web/1.0 CFNetwork/609.1.4 Darwin/13.0.0"
<SERVER> - - [30/Jan/2013:11:46:11 +0100] "GET /apple-touch-icon-114x114-precomposed.png HTTP/1.1" 401 483 "-" "Web/1.0 CFNetwork/609.1.4 Darwin/13.0.0"
<SERVER> - <USER> [30/Jan/2013:11:46:11 +0100] "GET /<PATH>/resources/css/app.css?1359542772700 HTTP/1.1" 200 212323 "https://<SERVER>/<PATH>/" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B142"
<SERVER> - - [30/Jan/2013:11:46:11 +0100] "GET /apple-touch-icon-114x114.png HTTP/1.1" 401 483 "-" "Web/1.0 CFNetwork/609.1.4 Darwin/13.0.0"
<SERVER> - - [30/Jan/2013:11:46:12 +0100] "GET /apple-touch-icon-114x114.png HTTP/1.1" 401 483 "-" "Web/1.0 CFNetwork/609.1.4 Darwin/13.0.0"
<SERVER> - - [30/Jan/2013:11:46:12 +0100] "GET /apple-touch-icon-precomposed.png HTTP/1.1" 401 483 "-" "Web/1.0 CFNetwork/609.1.4 Darwin/13.0.0"
<SERVER> - <USER> [30/Jan/2013:11:46:12 +0100] "GET /<PATH>/app.js?1359542772702 HTTP/1.1" 200 452182 "https://<SERVER>/<PATH>/" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B142"
<SERVER> - <USER> [30/Jan/2013:11:46:13 +0100] "GET /<PATH>/index.html HTTP/1.1" 200 5179 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B142"
<SERVER> - - [30/Jan/2013:11:46:13 +0100] "GET /apple-touch-icon-precomposed.png HTTP/1.1" 401 483 "-" "Web/1.0 CFNetwork/609.1.4 Darwin/13.0.0"
<SERVER> - - [30/Jan/2013:11:46:13 +0100] "GET /apple-touch-icon.png HTTP/1.1" 401 483 "-" "Web/1.0 CFNetwork/609.1.4 Darwin/13.0.0"
<SERVER> - - [30/Jan/2013:11:46:14 +0100] "GET /apple-touch-icon.png HTTP/1.1" 401 483 "-" "Web/1.0 CFNetwork/609.1.4 Darwin/13.0.0"
<SERVER> - <USER> [30/Jan/2013:11:46:14 +0100] "GET /<PATH>/dummy.json?_dc=1359542776441&page=1&start=0&limit=25 HTTP/1.1" 200 515 "https://<SERVER>/<PATH>/" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B142"
<SERVER> - <USER> [30/Jan/2013:11:46:14 +0100] "GET /<PATH>/app.json?1359542776454 HTTP/1.1" 200 290 "https://<SERVER>/<PATH>/" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B142"
<SERVER> - - [30/Jan/2013:11:46:14 +0100] "GET /apple-touch-icon-114x114-precomposed.png HTTP/1.1" 401 483 "-" "Web/1.0 CFNetwork/609.1.4 Darwin/13.0.0"
<SERVER> - - [30/Jan/2013:11:46:15 +0100] "GET /<PATH>/undefined HTTP/1.1" 401 483 "-" "Web/1.0 CFNetwork/609.1.4 Darwin/13.0.0"
<SERVER> - - [30/Jan/2013:11:46:15 +0100] "GET /apple-touch-icon-114x114-precomposed.png HTTP/1.1" 401 483 "-" "Web/1.0 CFNetwork/609.1.4 Darwin/13.0.0"
<SERVER> - - [30/Jan/2013:11:46:16 +0100] "GET /apple-touch-icon-114x114.png HTTP/1.1" 401 483 "-" "Web/1.0 CFNetwork/609.1.4 Darwin/13.0.0"
<SERVER> - - [30/Jan/2013:11:46:16 +0100] "GET /<PATH>/undefined HTTP/1.1" 401 483 "-" "Web/1.0 CFNetwork/609.1.4 Darwin/13.0.0"
<SERVER> - - [30/Jan/2013:11:46:16 +0100] "GET /apple-touch-icon-114x114.png HTTP/1.1" 401 483 "-" "Web/1.0 CFNetwork/609.1.4 Darwin/13.0.0"
<SERVER> - - [30/Jan/2013:11:46:16 +0100] "GET /apple-touch-icon-precomposed.png HTTP/1.1" 401 483 "-" "Web/1.0 CFNetwork/609.1.4 Darwin/13.0.0"
<SERVER> - - [30/Jan/2013:11:46:16 +0100] "GET /apple-touch-icon-precomposed.png HTTP/1.1" 401 483 "-" "Web/1.0 CFNetwork/609.1.4 Darwin/13.0.0"
<SERVER> - - [30/Jan/2013:11:46:17 +0100] "GET /apple-touch-icon.png HTTP/1.1" 401 483 "-" "Web/1.0 CFNetwork/609.1.4 Darwin/13.0.0"
<SERVER> - - [30/Jan/2013:11:46:17 +0100] "GET /apple-touch-icon.png HTTP/1.1" 401 483 "-" "Web/1.0 CFNetwork/609.1.4 Darwin/13.0.0"
This is almost identical to the log that results from a request using Safari but some images are also requested.
To this point, everything works as expected, however, when you open the app a second time from the homescreen the log won't show any entry, which means it tries to load a cached version and does not attempt to reconnect to the server.
Since this behaviour is reproducable in a very simple setting, should I perhaps file a bug report? Or is there anything wrong with my setup?
It would really help if this problem could be solved, since our users cannot profit from caching as it is.