Welcome! Log In Create A New Profile

Advanced

HTTP to HTTPS doesn't work to Angular app

Posted by camimartins 
HTTP to HTTPS doesn't work to Angular app
June 23, 2019 02:32PM
I want to make a redirect HTTP to HTTPS with proxy to my Angular app. The HTTP > HTTPS redirect works, but later this the ssl proxy can't reach the Angular app on localhost:4200.

When I set to 80 port only it works.

I also tried to put both with the same server names, proxy in the both servers, etc...

"server {
listen 80;
return 301 https://$host$request_uri;
}

server {

listen 443;
server_name example.com;

ssl_certificate /etc/nginx/ssl/example.com.crt;
ssl_certificate_key /etc/nginx/ssl/example.com.key;

ssl on;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;

access_log /var/log/nginx/site.access.log;

location / {

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

# Fix the “It appears that your reverse proxy set up is broken" error.
proxy_pass http://localhost:4200;
proxy_read_timeout 90;
proxy_redirect http://localhost:4200 https://example.com;
}
}"
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 313
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready