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 7736643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:47:29+00:00 2026-06-01T07:47:29+00:00

I have two domains – abc.com and xyz.com. I have a CNAME that points

  • 0

I have two domains – abc.com and xyz.com. I have a CNAME that points xyz.com to abc.com. xyz.com sets a cookie nx=true. Given this setup I should be able to read the cookie on abc.com. Here’s a sample Java code `enter code here

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    PrintWriter out = response.getWriter();

    Enumeration<String> h = request.getHeaders("Cookie");
    while (h.hasMoreElements()) {
        out.println("From request.getHeaders(\"Cookie\")-->" + h.nextElement().toString());

    }
        out.flush();
    out.close();

}
  • 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-06-01T07:47:31+00:00Added an answer on June 1, 2026 at 7:47 am

    The browser doesn’t know (or care) wether it’s a CNAME, A-record or whatever; all it knows is that it’s a different domain and you can’t set cross-domain cookies. You might want to check out “How Facebook sets and uses cross-domain cookies” for tips or this SO answer.

    It’s a whole other ballgame if you had to set a cookie for, for example, the domains abc.foo.com and xyz.foo.com. In that case all you need to do is set the cookie’s domain to not include the “subdomain”, “hostname”, whatever you want to call “abc” and “xyz”.

    For more information, check out this Wikipedia article.

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

Sidebar

Related Questions

This is the setup: I have two websites on two different domains: www.website1.com www.someotherwebsite.com
I have two different domains (let's say www.site1.com and www.site2.com) that point to the
I have two domains that are aliases, domain1.com and domain2.com Currently they are both
As a bit of background, we have two domains: mydomain.com mydomain.cz mydomain.cz points to
I have a site that redirects from www.domain.com to www.domain.com/sub I have two domains
I have two domains that point to the same IP, which is an Ubuntu
I have two domains: mydomain.com and mydomain.fr They both correspond to the same IP
We have two domains, example.com and example.net · We want every request to example.net
I have two domains. One domain contains the login script. It creates a cookie
I couldn't found this answer in Stackoverflow, but I have two domains and two

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.