Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4254242
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:03:23+00:00 2026-05-21T05:03:23+00:00

I need an HttpOnly authentication cookie to work on: mydomain.com www.mydomain.com abc.mydomain.com so that

  • 0

I need an HttpOnly authentication cookie to work on:

mydomain.com
www.mydomain.com
abc.mydomain.com

so that I can be logged into all three places via a single login.

This is working fine, by setting my cookie domain to:

.mydomain.com

here is the response header that sets the cookie:

MYAUTHCOOKIE=FOO; domain=.mydomain.com; path=/; HttpOnly

This all works fine for normal browser requests.

However, I need to make an AJAX request from mydomain.com and www.mydomain.com to abc.mydomain.com.

When I make the request, it isn’t passing the authentication cookie. Why is this, and what can i do about it?

If i make a request to the same host as the page the JS resides on, it does send the cookie :s

Here’s my request code:

$.ajax({
    type: "POST"
    , data: { data: { foo: bar} }
    , dataType: "json"
    , url: "http://abc.mydomain.com/foo"
    , timeout: 5000
    , success: function (data, textStatus) {
        alert('woo!');
    }
    , error: function (xhr, textStatus, error) {
        alert('meh');
    }
});

Is this some cross domain policy? Why doesnt the cookie domain make this work?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T05:03:24+00:00Added an answer on May 21, 2026 at 5:03 am

    According to the same origin policy, subdomains are indeed “hostile” to your top domain, but it can be fixed by setting document.domain (same article).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need help with a query that I wrote: I have three tables Company id
I have a set of C# Selenium tests that need to delete a cookie
Need to have a type-safe bag of items that all implement a generic interface.
need a little help with this one. I have a form that I am
As the question says can you find out if a cookie exists within Javascript
I'm trying to do some automated web requests and need to maintain a cookie
Need to choose optimal data structure for fast work with list of locations and
Need something simulat jcrop plucgin (link to example is here: http://publikz.com/one-more-task-rounded-selection-in-jquery/ ) but with
I need to persist a few cookies (they are not marked HttpOnly) between requests
Need a function that takes a character as a parameter and returns true if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.