Spring boot 在spring引导中重定向时,错误https变为http,端口为443
我使用nginx为我的springboot项目配置ssl,我使用它创建sslcer。 当我准备创建新记录时,我的路径仍然是https 但是,当我单击SaveChanges时,在成功创建之后,重定向以返回到列表页面,返回路径变成http,端口443Spring boot 在spring引导中重定向时,错误https变为http,端口为443,spring-boot,nginx,redirect,Spring Boot,Nginx,Redirect,我使用nginx为我的springboot项目配置ssl,我使用它创建sslcer。 当我准备创建新记录时,我的路径仍然是https 但是,当我单击SaveChanges时,在成功创建之后,重定向以返回到列表页面,返回路径变成http,端口443 @PostMapping("/create") @PreAuthorize("{@appAuthorizer.authorize(authentication, 'INSERT', this)}"
@PostMapping("/create")
@PreAuthorize("{@appAuthorizer.authorize(authentication, 'INSERT', this)}")
public String create(Locale locale, Model model, @ModelAttribute("category") Category category,
BindingResult result){
try{
if(categoryService.addNew(category)){
return "redirect:/admin/category/list?page=1";
}
return "categories/add-category";
}catch (Exception e){
return "error";
}
这是我的nginx配置
upstream ecommerce_service {
server localhost:8023;
}
server {
listen 80;
server_name ecommerce-hieutm.tk www.ecommerce-hieutm.tk;
return 301 https://ecommerce-hieutm.tk$request_uri;
}
server {
listen 443 default ssl;
server_name ecommerce-hieutm.tk www.ecommerce-hieutm.tk
root /var/www/html/;
ssl_certificate /etc/nginx/certificate_ca_bundle.crt;
ssl_certificate_key /etc/nginx/private.key;
#server_name ecommerce-hieutm.tk www.ecommerce-hieutm.tk
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers AES128-SHA:AES256-SHA:RC4-SHA:DES-CBC3-SHA:RC4-MD5;
access_log /var/log/nginx/ecommerce.access.log;
error_log /var/log/nginx/ecommerce.error.log;
location / {
root /var/www/html/;
index index.html;
proxy_pass http://ecommerce_service;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_request_headers on;
proxy_pass_header Server;
proxy_set_header X-NginX-Proxy true;
proxy_redirect off;
}
这是一个错误
有人能帮我吗,谢谢