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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:04:04+00:00 2026-06-10T01:04:04+00:00

/*set the response header*/ Form responseHeaders = (Form) getResponse().getAttributes().get(org.restlet.http.headers); if (responseHeaders == null) {

  • 0
/*set the response header*/
    Form responseHeaders = (Form) getResponse().getAttributes().get("org.restlet.http.headers"); 
    if (responseHeaders == null) { 
        responseHeaders = new Form(); 
        responseHeaders.add("Access-Control-Allow-Origin", "*");
        responseHeaders.add("Access-Control-Allow-Methods", "POST, GET, PUT, DELETE");
        getResponse().getAttributes().put("org.restlet.http.headers", responseHeaders); 
    } 

I added this in my restlet 2.0 code to allow for cross domain access, this does make the first GET to work on page load, but when I try to do POST later(with backbone model.save()), browser sends Options with a null entity instead.

It does send the right POST if I did not add the code above

This happens on Opera, Firefox, and Chrome (works fine if I start chrome with –disable-web-security), so i assume it is still a browser security issue, could anyone provide explanations on why this would happen and what might be the fix?

  • 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-10T01:04:06+00:00Added an answer on June 10, 2026 at 1:04 am

    From What is the HTTP OPTIONS method?

    This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval.

    I have fought several times with CORS issues and I have always solved them with the method of try and error my suggestion for your case is add OPTIONS to your Allow Methods :

    "Access-Control-Allow-Methods": "POST, GET, PUT, DELETE, OPTIONS"
    

    And make your server to respond to OPTIONS request with an *, in Sinatra is like this:

    options "/*" do
      "*"
    end
    

    Update

    For the new issue explained in the comment about the error header field Content-Type is not allowed by Access-Control-Allow-Headers.

    Try to add another CORS header:

    "Access-Control-Allow-Headers": "origin, x-requested-with, content-type"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is this defined? Or is it set with a header, similar to the HTTP-response?
I am trying to set a cookie in my Google App Engine page: self.response.headers.add_header('Set-Cookie','CookieName=1234;
If my cookie is set like this: Response.Cookies(Employees)(UserID) = 43 How do I get
Is there a way to get the Content-Type of the response or conversely set
At the moment we set content-type in our responce headers, a bit like this...
In my Controller Action I set Cookie with Response.SetCookie(myCookie) method. In my Unit Test
I need to set up a protocol for fast command/response interactions. My instinct tells
response.Cookies( SOFTWARE_PROGRAM_NAME).Expires = datetime.now.adddays(365*10) this sets expiration for 10 years. Anyway to set it
In my servlet I have the following code: response.setContentType(application/json);//set json content type PrintWriter out
I have the following code $.post( /factory/set,{ key : value }, function(response) { });

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.