Results 1 to 6 of 6

Thread: ExtJS5 and AJAX DefaultHeaders not working

  1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    20
    Answers
    2

    Default ExtJS5 and AJAX DefaultHeaders not working

    Here's the fiddle:

    https://fiddle.sencha.com/#fiddle/blp

    According to the documentation a new header attribute must be submitted, however, if you inspect the request with chrome developer tools you will see the header is missing

    Screenshot (36).jpg

  2. #2
    Sencha User slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,165
    Answers
    505

    Default

    Hi,

    Try with headers instead of defaultHeaders

    http://docs.sencha.com/extjs/5.0/api...method-request

  3. #3
    Sencha User
    Join Date
    Jan 2013
    Posts
    20
    Answers
    2

    Default

    Hi there,

    I tried 3 ways to add a header to my request, but none of them seems to work. Please have a look at my fiddle:

    https://fiddle.sencha.com/#fiddle/blp

  4. #4
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791
    Answers
    585

    Default

    The Fiddle will struggle with a cross-domain, non-https request like that. Change the URL to:

    Code:
    url: '/',
    Then you'll see custom2 on the request.

  5. #5
    Sencha User
    Join Date
    Apr 2012
    Posts
    110
    Answers
    2

    Default

    Hi,
    I am facing the same problem. Any solution for this issue?

    My Code :
    Code:
    Ext.Ajax.request({
                url: 'https://localhost:8112/rest/',
                method: 'POST',
                cors: true,
                useDefaultXhrHeader: false,
                headers: {
                    'loginuser': 'dinesh'
                }
            });
    RequestHeader.png

    In the above image "loginuser" header prams added in " Access-Control-Request-Headers".

    I verified this URL: http://www.programering.com/a/MTM2UjMwATM.html, And this one is my exact requirement but if i try it is showing above "Request Header".
    Help ......
    Thanks in Advance....
    Dinesh GK

  6. #6
    Sencha User
    Join Date
    Apr 2012
    Posts
    110
    Answers
    2

    Default

    I find solution for my problem.
    This issue because of response header allow in back-end.like follows

    response.setHeader("Access-Control-Allow-Headers", "Authorization,Content-Type");


    Quote Originally Posted by DineshGudikandula View Post
    Hi,
    I am facing the same problem. Any solution for this issue?

    My Code :
    Code:
    Ext.Ajax.request({
                url: 'https://localhost:8112/rest/',
                method: 'POST',
                cors: true,
                useDefaultXhrHeader: false,
                headers: {
                    'loginuser': 'dinesh'
                }
            });
    RequestHeader.png

    In the above image "loginuser" header prams added in " Access-Control-Request-Headers".

    I verified this URL: http://www.programering.com/a/MTM2UjMwATM.html, And this one is my exact requirement but if i try it is showing above "Request Header".
    Help ......
    Thanks in Advance....
    Dinesh GK

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •