Elastic Beanstalk (Java) + Spring Boot + https

1. What you want to do

--Connect with https when running Spring Boot on Elastic Beanstalk's Java platform

2. Premise

--Https listener set in LB --The following communication paths

LB(443) <-> Nginx(80) <-> Spring Boot(5000)

3. What I did

--Set the following in application.properties

server.tomcat.remote-ip-header=x-forwarded-for
server.tomcat.protocol-header=x-forwarded-proto

--For environment variables, set as follows

SERVER_TOMCAT_REMOTE_IP_HEADER=x-forwarded-for
SERVER_TOMCAT_PROTOCOL_HEADER=x-forwarded-proto

--server.tomcat.remote-ip-header is for remote IP address, so it works without setting --The following AWS manual describes the header --HTTP Headers and Classic Load Balancer -Details of Elastic Load Balancing

3.1. If I didn't do anything ...

--It becomes http when redirecting --Page redirect after authentication --PRG pages

4. Bonus

--When accessed via https, Set-Cookie has Secure. --Redirect http traffic to https --How do I use ELB's Classic Load Balancer to redirect HTTP traffic to HTTPS? -Application Load Balancer Listener -[New function] No need to implement on Web server! You can now redirect with just ALB!

end.

Recommended Posts

Elastic Beanstalk (Java) + Spring Boot + https
Deploy a Spring Boot application on Elastic Beanstalk
[Java] Thymeleaf Basic (Spring Boot)
CICS-Run Java application-(4) Spring Boot application
[Java] [Spring] Spring Boot 1.4-> 1.2 Downgrade Note
Spring Boot + Java + GitHub authentication login
Java --Jersey Framework vs Spring Boot
Spring Java
[Java] LINE integration with Spring Boot
[Java] [Spring] Spring Boot Dependency injection mysterious hamarineta
HTTPS with Spring Boot and Let's Encrypt
Create Java Spring Boot project in IntelliJ
Spring Boot + Docker Java development environment construction
Challenge Spring Boot
Spring Boot Form
Spring Boot Memorandum
gae + spring boot
[Java] Spring DI ③
[Java / Spring Boot] Spring security ④ --Implementation of login process
Java tips-Create a Spring Boot project in Gradle
[Java / Spring Boot] Spring security ⑤ --Implementation of logout processing
[Java] Hello World with Java 14 x Spring Boot 2.3 x JUnit 5 ~
[Java] Article to add validation with Spring Boot 2.3.1.
LINE Bot x Java (Spring Boot) construction procedure
Create a portfolio app using Java and Spring Boot
SPRING BOOT learning record 01
Spring Boot + Heroku Postgres
Spring boot memo writing (1)
First Spring Boot (DI)
Spring Boot2 cheat sheet
Spring Boot exception handling
Spring Boot Servlet mapping
Spring boot development-development environment-
Spring Boot learning procedure
Learning Spring Boot [Beginning]
Spring boot memo writing (2)
Spring Boot 2.2 Document Summary
[Spring Boot] DataSourceProperties $ DataSourceBeanCreationException
Spring Boot 2.3 Application Availability
Spring boot tutorials Topics
Download with Spring Boot
[Java / Kotlin] Escape (sanitize) HTML5 support with unbescape [Spring Boot]
Handle Java 8 date and time API with Thymeleaf with Spring Boot
[Java] Deploy the Spring Boot application to Azure App Service
How to call and use API in Java (Spring Boot)
Introducing Spring Boot2, a Java framework for web development (for beginners)
Domain Driven Development with Java and Spring Boot ~ Layers and Modules ~
[Java] Sample project for developing web applications with Spring Boot
[Spring Boot] Environment construction (macOS)
Set context-param in Spring Boot
Try Spring Boot from 0 to 100.
Generate barcode with Spring Boot
Hello World with Spring Boot
Java Config with Spring MVC
Spring Boot on Microsoft Azure
Implement GraphQL with Spring Boot
Spring + Gradle + Java Quick Start
Get started with Spring boot
Hello World with Spring Boot!
Spring Boot 2 multi-project in Gradle
[Spring Boot] Web application creation