-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rewriting ajax requests #22
Comments
When I try your page, I see "XMLHttpRequest cannot load https://httpbin.org/bytes/8. Request header field X-Requested-With is not allowed by Access-Control-Allow-Headers. " message in console. This may have something to do with configuration of access control on the server. |
Thanks so much for taking a look @ilinsky, and sorry I linked to a bad plunker! Fixed my example. Here is a version where the conditional rewrite code is commented out and clicking the button successfully loads https://httpbin.org/ip: http://embed.plnkr.co/5Vpdohf69anQlUutHl7Y/preview When you uncomment out XmlHTTPRequest.js and the rewrite logic, after clicking the button the state stays stuck at "awaiting result", whether or not you check the rewrite checkbox: http://embed.plnkr.co/dglwlMoR14nTHymvkssW/preview This time it's rewriting a cross-origin request to a same-origin request, so it should be even more likely to work. Looking in Developer Tools, there are no errors in the JavaScript console, and the XHR is never even opened or sent. Do you have any idea what's going on here? Thanks again for any help! |
(you may have to Shift+Reload on http://embed.plnkr.co/5Vpdohf69anQlUutHl7Y/preview to make sure you get the newest version) |
Hi @ilinsky, did that example make sense / demonstrate the issue properly? Much appreciate any time you have to take a look. |
I'm trying to use xmlhttprequest.js to intercept an ajax request and request a different url instead. The code all looks correct, but it's failing silently with no hints in the developer console. Here is a live preview along with the code:
http://embed.plnkr.co/5Vpdohf69anQlUutHl7Y/preview
Am I doing something wrong, or is this just not possible?
Thanks in advance for any tips.
The text was updated successfully, but these errors were encountered: