Igor Cova
Igor Cova

Reputation: 3524

Do I need to config https in my app if https already configured in nginx

I've seen some articles about how to add https to .Net Core app.

And I don't understand I need to config https for my '.Net Core' API service or not, because I've already configured Nginx for it.

I think this question is relevant for any backend type not only for '.Net Core'

My Nginx config looks like there:

server {
  listen 443 ssl;
  server_name example.com;
  ssl_stapling on;
  ssl on;
  ssl_certificate /etc/ssl/example.com.crt;
  ssl_certificate_key /etc/ssl/example.com.key;

  location / {
    proxy_pass http://localhost:5050;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
    error_page 404 = 301 http://page.example.com/;
  }
}

Upvotes: 0

Views: 101

Answers (1)

webartisan
webartisan

Reputation: 9

Your NGinx is now setup for https, but your app also needs to be redirected to https. You'll need to create an .htaccess file and you'll need to define to redirect to https instead of standard http.

Here's the complete manual for forcing https: Forcing Https by Inmotion hosting

Upvotes: 1

Related Questions