Piyush dhore
Piyush dhore

Reputation: 731

Using https rather than http in angular to get data from server

My application has the following architecture,

  1. An angular 1.5 application has a service which sends request to one of endpoints on server.

  2. The request is received by an nginx server if it is an http request it is redirected to https server.

  3. Then the nginx server redirects my request to upstream node server.

In angular I use the http service to send get and post request.

I don't know if my request along with the data are travelling encrypted by https protocol or as plain text by http protocol from angular to server and back.Can someone please clarify what is going on, the data might contains personal details of user and it is important that it is encrypted.

This question asks the same but is not answered properly.

Thank You.

Upvotes: 0

Views: 3002

Answers (1)

Gavin Gregory
Gavin Gregory

Reputation: 139

You can force $http to use HTTPS simply by ensuring that your URL is formatted correctly.

var req = {
 method: 'POST',
 url: 'https://localhost/api/v1/users', // note: https specified
 headers: {
   'Content-Type': undefined
 },
 data: { test: 'test' }
}

angularjs docs - $https

Upvotes: 1

Related Questions