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

  • Home
  • SEARCH
  • 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 6826885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:12:03+00:00 2026-05-26T22:12:03+00:00

Disclaimer: I’m not a Java guy, but ended up having to maintain some Java

  • 0

Disclaimer: I’m not a Java guy, but ended up having to maintain some Java code.

I was recently trying to debug why a Java server was returning status code 500 on certain requests. I narrowed it down to some code that essentially did:

httpServletResponse.addHeader("Set-Cookie", "FOO=BAR; domain=localhost")

If if replaced domain=localhost with the domain from the URL, it worked. If I just removed that line of code, it also worked.

I found this rather surprising. I’d expect the browser to ignore such a cookie line, or at the least not have the whole server blow up. Searching around, I couldn’t find any documentation about any such constraints. Is this expected/documented behavior somewhere?

  • 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-26T22:12:03+00:00Added an answer on May 26, 2026 at 10:12 pm

    After enough digging and logging, I eventually tracked this down to the specific servlet server implementation I’m using, which really doesn’t like domain=localhost.

    What I was really after was some specification that said something like, “Set-cookie with a bad domain value should result in a 500 server error”, or otherwise directly addressed the problem of “what servlets should do if a bad cookie domain is given in Set-Cookie.”

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

Sidebar

Related Questions

Disclaimer: This is not actually a programming question, but I feel the audience on
Disclaimer: This is for a homework assignment, but the question is not regarding the
DISCLAIMER: The following code is not something I would ever use in a real
Disclaimer This is not strictly a programming question, but most programmers soon or later
Disclaimer: I'm not very good at Java and just comparing read/writer locks between C#
[Disclaimer]: Currently we are running older SQL Server 2000, but we could update to
Disclaimer: I understand the question is very basic, but I could not find the
Disclaimer: I am not going to say that I am the most experienced Java
Disclaimer: the following is a sin against XML. That's why I'm trying to change
Disclaimer: I realize I can generate this at runtime in Java, this was needed

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.