Ionic http post - .jsp compatibility issue?


#1

I’m using Angular HTTP to make a post request to a .jsp controller.

    return this.http.post(this.submitTimeURL,{test:'hello'}).map((response: Response)=> {
        return response.json();
    }).subscribe((data)=>{
        debugger;
    });

In chrome dev tools I am seeing the following error:

Request Method: OPTIONS
Status Code: 405 JSPs only permit GET POST or HEAD

it’s as if the browser didn’t detect that the request was a post?
Any ideas on how I can get around this error?

Thanks


#2

Google “CORS” and “preflight request”. This is a security feature of browsers that you can’t easily turn off.

You can probably work around by using the Service Proxies offered by Ionic CLI: https://github.com/ionic-team/ionic-cli#service-proxies


#3

Okay, thank you for the guidance. :slight_smile: