SameSite 문제 허용 설정

간단한 예로 외부 도메인에서 나의 도메인으로 POST 로 호출 할 경우 기존 나의 도메인 쿠키가 유지되지 않는 문제.
나의 경우문제 : 나의 도메인  -> 외부도메인 팝업 호출 -> 외부도메인에서 나의 도메인에 결과값을 넣어 POST로 호출
      - 이 경우 예전에는 브라우저에 나의 세션쿠키 정보가 남아 있어 누구의 결과값인지 바로 확인가 가능 했으나.
      - 크롬 80? 부터는 외부 도메인에서 POST로  호출지 쿠키 정보가 삭제됨.
              ( SameSite 속성의 기본 값을 "None"에서 "Lax"로 변경한 것 때문)
      - 이로인해 세션쿠키가 새로 발급되어 내가 누구인지를 읽어버림

그래서 외부 도메인의 POST 호출을 허용하긴위해서 SameSite ="None"으로 설정해야 합니다.
예시....

@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {


	@Bean
	public CookieSerializer cookieSerializer() {
		DefaultCookieSerializer serializer = new DefaultCookieSerializer();
		serializer.setCookieName("SESSION");
		
		serializer.setSameSite("None");
		serializer.setUseSecureCookie(true);
		return serializer;
	}


}

단 : None 설정시 http에서는 적용되지 않고 https(SSL) 적용된 경우만 적용이 된다고 합니다. (localhost는 적용됨)

자세한 사항은 제가 참고 했던 사이트를 확인해 주세요. ^^
아 그리고 부트 2.6 부터는 applications.yml 설정이 가능한 것 같습니다. (하단에 설정 관련 내용 추가)
저는 낮은 버전을 쓰고 있고. 버전을 올릴 수 없는 상태라 ^^

https://shanepark.tistory.com/349
 * https://github.com/spring-projects/spring-session/issues/1577
 * https://cublip.tistory.com/336

https://seob.dev/posts/%EB%B8%8C%EB%9D%BC%EC%9A%B0%EC%A0%80-%EC%BF%A0%ED%82%A4%EC%99%80-SameSite-%EC%86%8D%EC%84%B1/

 

Spring security 5.1.x에서 Crossorigin에서 요청시(결제모듈 등..) session cookie('SESSION' value) 초기화로 로그

spring boot를 2.1 이상으로 업데이트 하니(spring security 5.1 이상) lg uplus 결제모듈 호출 후 리턴값 받고나서 계속 로그인이 튕겨서 보니 세션값이 있는 쿠키가 계속 삭제되더라구요.. cors, csrf문제인가

cublip.tistory.com

 

Spring Session과 Cookie SameSite 정책

Intro SpringBoot 1.5 버전에서 2.5 버전으로 마이그레이션 작업이 대부분 완료 되었는데 SAML을 이용한 SSO 로그인 부분에서 굉장히 오래동안 해결하지 못하던 문제가 있었습니다. 분명 해당 부분의 코

shanepark.tistory.com

* 추가 :  최신 스프링 부트  application.yml 설정방법

server:
  servlet:
    encoding:
      charset: UTF-8
      enabled: true
      force: true
    session:
      cookie:
        name: MY_USER_SID
        http-only: true #브라우저 접근불가쿠키여부
        secure: true #HTTPS전용쿠키여부
        same-site: none
반응형

1. 새 릴리스 확인: 아래 명령이 최신 릴리스와 권장 업그레이드 명령을 보여준다.

sudo dnf check-release-update

2. 최신 버전 목록이 표시 된다.

 A newer release of "Amazon Linux" is available.

  Available Versions:

  Version 2023.8.20250808:
    Run the following command to upgrade to 2023.8.20250808:

      dnf upgrade --releasever=2023.8.20250808

    Release notes:
     https://docs.aws.amazon.com/linux/al2023/release-notes/relnotes-2023.8.20250808.html

  Version 2023.8.20250818:
    Run the following command to upgrade to 2023.8.20250818:

      dnf upgrade --releasever=2023.8.20250818

    Release notes:
     https://docs.aws.amazon.com/linux/al2023/release-notes/relnotes-2023.8.20250818.html

  Version 2023.8.20250908:
    Run the following command to upgrade to 2023.8.20250908:

      dnf upgrade --releasever=2023.8.20250908

    Release notes:
     https://docs.aws.amazon.com/linux/al2023/release-notes/relnotes-2023.8.20250908.html

  Version 2023.8.20250915:
    Run the following command to upgrade to 2023.8.20250915:

      dnf upgrade --releasever=2023.8.20250915

    Release notes:
     https://docs.aws.amazon.com/linux/al2023/release-notes/relnotes-2023.8.20250915.html

  Version 2023.9.20250929:
    Run the following command to upgrade to 2023.9.20250929:

      dnf upgrade --releasever=2023.9.20250929

    Release notes:
     https://docs.aws.amazon.com/linux/al2023/release-notes/relnotes-2023.9.20250929.html

3. 특정 릴리스로 전체 업그레이드:
    - 다음처럼 릴리스 버전을 명시해 패키지 전부를 최신으로 맞춘다

sudo dnf upgrade --releasever=2023.9.20250929 -y

4. 항상 최신 버전으로 업데이트 하고 싶다면 

sudo dnf upgrade --releasever=latest -y

5. 매번 영구적으로 최신 버전으로 업데이트 하고 싶다면.
    - sudo dnf upgrade -y 하면 항상 최신버전으로 update

echo latest | sudo tee /etc/dnf/vars/releasever
sudo dnf upgrade -y
반응형

'개발 > AWS' 카테고리의 다른 글

AWS EC2 Jenkins /tmp 디렉토리 용량 부족 해결  (0) 2025.10.02
EC2 Amazon Linux 생성  (0) 2018.12.18
AWS S3 API 이용 키 생성  (0) 2018.11.28

Built-In Node Bring this node back online Update offline reason This is the Jenkins controller's built-in node. Builds running on this node will execute on the same system and as the same user as the Jenkins controller. This is appropriate e.g. for special jobs performing backups, but in general you should run builds on agents. Learn more about distributed builds. Disk space is below threshold of 1.00 GiB. Only 447.93 MiB out of 452.42 MiB left on /tmp.

 

메시지 그대로면 “Disk space is below threshold… /tmp 남은 용량 447.93MiB” 때문에 Jenkins 컨트롤러의 Built-In 노드가 자동으로 Offline 난 상태! 먼저 용량을 확보해서 온라인으로 복귀

1.  /tmp가 어디에 있는지 확인!

# /tmp가 tmpfs(메모리)인지 디스크인지 확인!
findmnt -no SOURCE,FSTYPE,OPTIONS /tmp
# 예) tmpfs tmpfs size=1G …  → 메모리 기반!
# 예) /dev/nvme0n1p1 xfs …   → 디스크 파티션!

    - EC2에 t3-micro에  설치 했는데 메모리 기반 되어있음.
    - 서버 메모리가 1GB인데 메모리 기반 이라 용량 부족.


2. Jenkins 전용 임시폴더 세팅

sudo mkdir -p /var/lib/jenkins/tmp
sudo chown -R jenkins:jenkins /var/lib/jenkins/tmp
sudo chmod 700 /var/lib/jenkins/tmp
sudo mkdir -p /etc/systemd/system/jenkins.service.d

sudo tee /etc/systemd/system/jenkins.service.d/override.conf >/dev/null <<'EOF'
[Service]
Environment="JAVA_OPTS=-Djava.io.tmpdir=/var/lib/jenkins/tmp"
EOF

sudo systemctl daemon-reload
sudo systemctl restart jenkins

 

반응형

'개발 > AWS' 카테고리의 다른 글

AWS EC2 최신버전 업데이트 하기  (0) 2025.10.02
EC2 Amazon Linux 생성  (0) 2018.12.18
AWS S3 API 이용 키 생성  (0) 2018.11.28

+ Recent posts