View Full Version : REST Proxy and SSL

24 Aug 2012, 8:41 AM
Hello Ext JS Experts,

Hopefully I have the right forum for this question. I am trying to setup a REST proxy to a REST server running on a different server from where I am running my EXT JS app. The REST server only accepts SSL connections and requires username/password. Because it is on a different server I have setup an Apache proxy to proxy API requests from the Apache server where the app is running to the server which has the REST API. I realize I can do CORS and use the full URL in the proxy but I think that requires some changes to the REST API server where I don't have access.

I can access the data using curl on the command line using:

curl -k -u user/pass https://localhost/api/v1.0/resource

so I know the proxy works. However, I can't seem to get the REST proxy to work. So here is the question: How do I tell the proxy to use SSL and pass the username and password?

Here is a snippet of my current code:

var store = Ext.create('Ext.data.Store', {
autoLoad: true,
autoSync: true,
model: 'Resource',
proxy: {
type: 'rest',
url: '../api/v1.0/resource',
username: 'username',
password: 'password',
pageParam: undefined,
startParam: undefined,
limitParam: undefined,
noCache: false,
headers: {'Accept': 'application/json'},
reader: {
type: 'json',
root: '',
model: 'Resource'

24 Aug 2012, 9:23 AM
You can use extraParams (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.proxy.Rest-cfg-extraParams) on your Proxy to send arbitrary parameters, noting that these params are included on every subsequent request.

proxy: {
type: 'rest',
url: '../api/v1.0/resource',
extraParams: {
username: 'someuser',
password: 'somepassword'

24 Aug 2012, 9:43 AM
I don't think this is what I need. This appends the username and password on the end of the URL. I need them to be part of the Basic auth. Also, how might I tell the proxy to use SSL?

24 Aug 2012, 11:27 AM
By configuring my web server to proxy HTTP to HTTPS I can get things working where the browser passes the username/password prompt to the end user. This avoids having it hardcoded in the code (a very good thing). However, I would still like to know how to get the REST proxy to use HTTPS/SSL/443 using a config option.