URL vom Pfad zur Subdomäne mit NGINX maskieren

URL vom Pfad zur Subdomäne mit NGINX maskieren

Ich möchte eine URL-Umschreibung wie folgt erreichen:
https://documentation.domain.com/loginto https://app.domain.com/login
https://api.domain.com/loginto https://app.domain.com/login
, jede Sudomain mit der URL {anything}.domain.com/login tohttps://app.domain.com/login

https://app.domain.com/sdkszu https://documentation.domain.com/sdks(unter Beibehaltung aller Abfrageparameter)
https://api.domain.com/sdkszu https://documentation.domain.com/sdks(unter Beibehaltung aller Abfrageparameter)
, jede beliebige Subdomain mit der URL {anything}.domain.com/sdks zuhttps://documentation.domain.com/sdks

https://app.domain.com/restApizu https://documentation.domain.com/restApi(unter Beibehaltung aller Abfrageparameter)
https://api.domain.com/restApizu https://documentation.domain.com/restApi(unter Beibehaltung aller Abfrageparameter)
, jede beliebige Subdomain mit der URL {anything}.domain.com/restApi zuhttps://documentation.domain.com/restApi

Alle oben genannten Domänen und Subdomänen liegen hinter Cloudflare mit aktiviertem SSL im Modus „Full Strict“. Wie kann ich das erreichen? Egal, was ich mache, ich bekomme immer „Zu viele Weiterleitungen“

Zertifikat mit Schlüssel aus der Cloudflare-Konfiguration (funktioniert):

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

verwandte Informationen