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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:52:43+00:00 2026-05-23T17:52:43+00:00

On domain A (localhost:8080) I run this code to access an unauthenticating REST serivce

  • 0

On domain A (localhost:8080) I run this code to access an unauthenticating REST serivce on domain B (localhost):

req = new XMLHttpRequest();
req.open('GET', 'http://localhost/rest/service');
req.send();

This works fine and I do get my response across domains as I have Apache on domain B set the response header:

Header set Access-Control-Allow-Origin "http://localhost:8080"

However if I now turn on authentication for the REST service and try to run the same request:

req.open('GET', 'http://admin:admin@localhost/rest/service');

It now produces this error in Firebug:

Access to restricted URI denied" code: "1012

I’m confused that I am able to sucessfully make cross domain ajax calls to the authenticated service bypassing the same origin policy, yet when authentication is required on the service Firefox decides not to allow the ajax call? How can I fix this without using jsonp etc, as the production server won’t be able to provide PHP or Servlet hosting.

  • 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-23T17:52:44+00:00Added an answer on May 23, 2026 at 5:52 pm

    It’s easy with JQuery 1.5+, which I recommend you use for your JavaScript solution:

    $.ajax({
        url: 'http://admin:admin@localhost/rest/service',
        crossDomain:true, // Here is the JSONP callback logic 
        success: function(data){
            console.log(data); // data is what comes back from your remote file
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I start glassfish with ~/.glassfish/bin/asadmin start-domain domain1 Everything works perfect. I enter to http://localhost:8080
The domain of this question is scheduling operations on constrained hardware. The resolution of
My domain model is this: we have a bunch of schools as the root
I am trying to get the facebook connect stuff working on my localhost. In
i have created new domain in grails and from a controller i've tried to
I can enter via web http://localhost:8080/tfs/web with any user, from remote or local, but
Is there a performance difference between TCP connections to: localhost / 127.0.0.1 a domain
while running asp.net application locally, the domain name shows ' http://localhost:50984/application1/ ' Can I
How is it possible to simply access to get and post attributes in lift
I am running a localhost instance (so domains are not my issue!) on my

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.