Deploy PRs to branch.dsv.su.se #1

Open
ansv7779 wants to merge 14 commits from deploy into main
Showing only changes of commit 309d19af29 - Show all commits

View File

@ -2,11 +2,14 @@ package se.su.dsv.branchdeploytesting;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.core.Ordered;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.web.filter.ForwardedHeaderFilter;
@SpringBootApplication
@EnableWebSecurity
@ -23,4 +26,15 @@ public class BlogApplication {
return http.build();
}
/**
* Spring runs on HTTP and is protected by a HTTPS proxy.
* This filter takes the `X-Forwarded-*` headers and updates the request to reflect the original HTTP request.
*/
@Bean
public FilterRegistrationBean<ForwardedHeaderFilter> forwardedHeaderFilter() {
var filterRegistrationBean = new FilterRegistrationBean<>(new ForwardedHeaderFilter());
filterRegistrationBean.setOrder(Ordered.HIGHEST_PRECEDENCE);
return filterRegistrationBean;
}
}