Skip to content

Instantly share code, notes, and snippets.

@Frechet
Created June 24, 2020 15:28
Show Gist options
  • Save Frechet/5b6ea78e3cdb9401c37cc89b7edbb1d3 to your computer and use it in GitHub Desktop.
Save Frechet/5b6ea78e3cdb9401c37cc89b7edbb1d3 to your computer and use it in GitHub Desktop.
# https://vkuzel.com/configuration-of-a-nginx-reverse-proxy-in-front-of-a-spring-boot-2-1-application-protected-by-oauth-2-0
# nginx
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header Host $host;
proxy_pass http://localhost:8080/;
}
# application.properties
server.use-forward-headers = true
# Optional: in case of your proxy running in a network different from Spring Boot application's network.
# server.tomcat.internal-proxies=90\.91\.92\.93
# Bonus: let's not force user to re-authorize too often by setting a session cookie validity to one day.
server.servlet.session.timeout=1d
server.servlet.session.cookie.max-age=1d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment