I'm trying to access Metabase API from my angular app but every time the preflight request from the browser ( Request Method: OPTIONS) giving status 404 and post request to "api/session" is failing.
But the same call when I'm trying from POSTMAN or tried with set up an API gateway with lambda proxy integration and a Lambda function which will do Http call to Metabase api is working.
Sample code from my angular service file.
fetchSessionToken() {
return this.http.post('http://mySiteName.elasticbeanstalk.com/api/session',
{
"username": "username",
"password": "password"
},
{
headers: { "Content-Type": "application/json" }
}).pipe(
tap( (response) => {
return response;
}, (err) => {
return throwError(err);
}
)
);
}
I tried a couple of things as listed below.
FIRST: Enabled https connection on elastic bean stack environment.
SECOND: Updated the application version on Elastic bean stack by adding some code on "metabase-setup.sh"(.ebextensions > metabase_config > metabase-setup.sh) to support CORS on Nginx.
both the experiments didn't work out for me.
Any help would be greatly appreciated!