NGINX를 사용하여 경로에서 하위 도메인까지 URL 마스크

NGINX를 사용하여 경로에서 하위 도메인까지 URL 마스크

URL을 다음과 같이 재작성하고 싶습니다.
https://documentation.domain.com/loginto https://app.domain.com/login
https://api.domain.com/login, https://app.domain.com/login
URL이 {anything}.domain.com/login인 모든 sudomainhttps://app.domain.com/login

https://app.domain.com/sdksto https://documentation.domain.com/sdks(모든 쿼리 매개변수 보존)
https://api.domain.com/sdksto https://documentation.domain.com/sdks(모든 쿼리 매개변수 보존)
, URL이 {anything}.domain.com/sdks인 모든 sudomainhttps://documentation.domain.com/sdks

https://app.domain.com/restApito https://documentation.domain.com/restApi(모든 쿼리 매개변수 보존)
https://api.domain.com/restApito https://documentation.domain.com/restApi(모든 쿼리 매개변수 보존)
, URL이 {anything}.domain.com/restApi인 모든 sudomainhttps://documentation.domain.com/restApi

위의 모든 도메인 및 하위 도메인은 Full Strict 모드에서 SSL이 활성화된 cloudflare 뒤에 있습니다. 어떻게 이를 달성할 수 있습니까? 무엇을 하든 항상 "리디렉션이 너무 많습니다"라는 메시지가 나타납니다.

cloudflare 구성의 키가 포함된 인증서(작동):

ssl_certificate     /home/company/domain/ssl/push_node_cloudflare.pem;
ssl_certificate_key /home/company/domain/ssl/push_node_cloudflare_privatekey.key;

관련 정보