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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:52:42+00:00 2026-06-02T06:52:42+00:00

I have this mootools request: new Request({ url: ‘http://localhost:8080/list’, method: ‘get’, }).send(); and a

  • 0

I have this mootools request:

new Request({
    url: 'http://localhost:8080/list',
    method: 'get',
}).send();

and a small python server that handles it with this:

from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import subprocess

class HttpHandler(BaseHTTPRequestHandler):
    def do_GET(self):
        if self.path == '/list':
            self.list()
        else:
            self._404()

    def list(self):
        self.response200()
        res = "some string"

        self.wfile.write(res)

    def _404(self):
        self.response404()
        self.wfile.write("404\n")

    def response200(self):
        self.send_response(200)
        self.send_header('Access-Control-Allow-Origin', '*')
        self.send_header('Access-Control-Allow-Headers', 'X-Request, X-Requested-With')
        self.send_header('Content-type', 'application/json')
        self.end_headers()

    def response404(self):
        self.send_response(404)
        self.send_header('Content-type', 'application/json')
        self.end_headers()

def main():
    try:
        server = HTTPServer(('', 8080), HttpHandler)
        server.serve_forever()
    except KeyboardInterrupt:
        server.socket.close()

if __name__ == '__main__':
    main()

When I attempt to make this request, I get these errors:

OPTIONS http://localhost:8080/ 501 (Unsupported method ('OPTIONS'))
XMLHttpRequest cannot load http://localhost:8080/. Origin null is not allowed by Access-Control-Allow-Origin.

I’m not sure what’s going on. Can someone help me out??

  • 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-02T06:52:44+00:00Added an answer on June 2, 2026 at 6:52 am

    exactly as the response string tells you: OPTIONS http://localhost:8080/ 501 (Unsupported method ('OPTIONS'))

    When javascript attempts to request a resource from another origin, modern browsers first ask the other server, the target, if it is ok to make that request from another origin, that’s exactly what the Access-Control* headers do. but this request does not happen in a normal GET, since that would be actually performing the request anyway, and instead use the OPTIONS method, which exists for the sole reason to inform clients what they are allowed to do, without actually doing it.

    So, you need a do_OPTIONS method, which might look something like:

    def do_OPTIONS(self):
        if self.path in ('*', '/list'):
            self.send_response(200)
            self.send_header('Allow', 'GET, OPTIONS')
            self.send_header('Access-Control-Allow-Origin', '*')
            self.send_header('Access-Control-Allow-Headers', 'X-Request, X-Requested-With')
        else:
            self.send_response(404)
        self.send_header('Content-Length', '0')
        self.end_headers()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with the Mootools get method and IE8. This is the
I have this class method in a mootools class: getData : function(){ var r
Issue: I have a Mootools Request object which sends a GET request to a
I have a request.json in mootools to get some data from a php function
How would I do this in mootools? I have an Unordered list items that
I'm new to Mootools and I'm stuck on the following problem. I have this
I am moving from jQuery to MooTools (for the fun..) and I have this
Have this self-made slider: http://jsfiddle.net/wyc3P/4/ What it does: takes min and max values in
I have this string 'john smith~123 Street~Apt 4~New York~NY~12345' Using JavaScript, what is the
So I have a bit of a problem. When I ask MooTools to send

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.