I'm using Nginx to
redirect all HTTP requests to HTTPS
in my spring boot application.This is the nginx configuration that i'm using,with that i was able to redirect all requests to Https but when i do it i get the status code returned correctly but it doesnt have the status code name anymore.if i remove nginx and run spring boot application alone i can get the http status with its code name and code.
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _ ;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
if ( $http_x_forwarded_proto != 'https' ) {
return 307 https://$host$request_uri;
}
location / {
proxy_set_header X-Forwarded-Proto http;
proxy_pass http://localhost:7070;
expires -1;
}
}
what am i doing wrong in here should i use proxy_redirect instead of proxy_pass, or am i missing anything in here.that'd be great if you can help.