In the url i am sending POST data but i crossed checked in the console in same URL then i am geting OPTION so plz the help

Not applicable
 
Solved Solved
0 4 382
1 ACCEPTED SOLUTION

Not applicable

@Vinux

This usually happens when you are sending cross domain request. But after OPTION, you might see post is also getting fired. In order to get through please try and set ACCESS-CONTROL-ALLOW in the header of response by setting * for all domain or your specific domain.

Also enable cors in your browser or by adding a policy.

Hope it helps. Let me know

View solution in original post

4 REPLIES 4

Not applicable

Please provide the sample proxy and request - that help debug this faster.

Not applicable

Hi Sri,

PROBLEM :- We are sending a POST Request , but in the APG Trace , we can see that Instead of POST , OPTIONS Request is getting posted.

Because of which our UI is Breaking . We cross checked the UI and we are confident that Http Request is perfect.

Here in I am posting all the Required Data Needed for you to Investigate

Our JSON Request and POST Request

var custjson = '{"name":"raja","username":"raja","password":"tata","age":"24","zip":"453212","address":"Japan","email":"raja@gmail.com","customerId":"10877088"}'; $.ajax( { type: 'POST', contentType: 'application/json', url: 'http://vinux1-test.apigee.net/ecommercedata/customers?apikey=n4HdbfArygkGyJUUkSFCTmF1iwA4JtxI', data:custjson , dataType: 'json', beforeSend : function() { alert(" beforeSend Signup "); }, success: function(data){ alert("" + JSON.stringify(data)); if(localStorage.cartFlag =="cart") { window.location.href="checkout.html"; } else { window.location.href="allProducts.html"; } }, error: function(){ alert("error"); } });

Proxy URL and its response

http://vinux1-test.apigee.net/ecommercedata/customers?apikey=n4HdbfArygkGyJUUkSFCTmF1iwA4JtxI

Here in I am attaching the Screenshot

proxy-url-response.jpg

APG Trace for the respective JSON Proxy Request

Here in I am attaching the Screenshot showing the Issue

apg-trace-for-proxyurl.jpg

Thanks

Ranjay

Not applicable

@Vinux

This usually happens when you are sending cross domain request. But after OPTION, you might see post is also getting fired. In order to get through please try and set ACCESS-CONTROL-ALLOW in the header of response by setting * for all domain or your specific domain.

Also enable cors in your browser or by adding a policy.

Hope it helps. Let me know

Not applicable

Hi @Vinux Thomas , You may want to check this

http://community.apigee.com/questions/3138/cors-policy-in-my-api-proxy-when-using-oauth-20.html#comm...

You can use the proxy bundle attached there for reference .