Skip to content
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

Cannot POST cross domain from edgex-ui #405

Closed
xuexiqiangzhe opened this issue Aug 6, 2020 · 1 comment
Closed

Cannot POST cross domain from edgex-ui #405

xuexiqiangzhe opened this issue Aug 6, 2020 · 1 comment
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@xuexiqiangzhe
Copy link

Hello,
I want to post a rule to the rule engine in JS interface.
Edgex UI is at http://127.0.0.1:4000
The rule engine runs at http://127.0.0.1:48075

The code in JS is following,jsonObj is what I want to POST to rule engine.

 $.ajax({
            url: 'http://127.0.0.1:48075/rules',
            type: 'POST',
			contentType: "application/json",
			data: JSON.stringify(jsonObj),
			crossDomain:true,
			//dataType:'jsonp',
            success: function(){
                console.log("make rule successfully");
            },
            error: function(){
				console.log(“make rule failed");
            }

But,The developer mode of browser shows:

Request Method: OPTIONS
Status Code: 405 Method Not Allowed
Access to XMLHttpRequest at 'http://127.0.0.1:48075/rules' from origin 'http://127.0.0.1:4000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
VM18:745 make rule failed
jquery.min.js:2 POST http://127.0.0.1:48075/rules net::ERR_FAILED

Thank you!

@xuexiqiangzhe xuexiqiangzhe changed the title Cannot cross domain POST from edgex-ui Cannot POST cross domain from edgex-ui Aug 7, 2020
@ngjaying ngjaying self-assigned this Aug 7, 2020
@jinfahua jinfahua added the kind/bug Categorizes issue or PR as related to a bug. label Aug 7, 2020
@jinfahua
Copy link
Collaborator

Done & close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants