Skip to main content
Level 2
May 6, 2022
Respondido

AEM Cloud : HTTPS protocol not getting preserved while redirecting to landing page by accessing domain(brand.com)

  • May 6, 2022
  • 1 resposta
  • 752 Visualizações

When I am accessing brand.com site, below redirects are happening

 

Actual:

https://www.brand.com(Status code : 302) -> http://www.brand.com/content/brand/in/en/landingpage(Status code : 302 Internal redirect) -> https://www.brand.com/content/brand/in/en/landingpage(Status code : 302) -> http://www.brand.com/en/landingpage(Status code : 302 Internal redirect) -> https://www.brand.com/en/landingpage(Status code : 304)

 

 

Expected :

 

There should not be redirect from https to http
https://www.brand.com ->

https://www.brand.com/content/brand/in/en/landingpage ->

https://www.brand.com/en/landingpage

 

Dispatcher Rewrite rule:

 

RewriteCond %{HTTP_HOST} brand.com
RewriteRule ^/?$ /content/brand/in/en/landingpage [R,L]

 

RewriteCond %{REQUEST_URI} !^/apps
RewriteCond %{REQUEST_URI} !^/content
RewriteCond %{REQUEST_URI} !^/etc
RewriteCond %{HTTP_HOST} brand.com
RewriteRule ^/(.*?)(/?)$ /content/brand/in/$1.html [PT,L,NC]

 

 

Please provide your inputs/suggestion to resolve this issue.

Este tópico foi fechado para respostas.
Melhor resposta por Anish-Sinha

Hi @sankar07 ,

I can see there are multiple 302 redirects happening which is not needed. Try below rules and modify as per your need. 1st to make sure the redirection is to https and 2nd one to append /content/brand. More [R] redirects are not needed in my opinion. You can have PT flag instead:-

RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^/?$ https://brand.com%{REQUEST_URI} [L,R]

RewriteCond %{HTTP_HOST} ^brand.com$ [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^/$ https://brand.com/en/landingpage [R=301,L] RewriteCond %{REQUEST_URI} !^/apps RewriteCond %{REQUEST_URI} !^/content RewriteCond %{REQUEST_URI} !^/etc
RewriteCond %{HTTP_HOST} brand.com RewriteRule ^/(.+) /content/brand/in/$1 [PT,L,NC]

 

1 Resposta

Anish-Sinha
Adobe Employee
Anish-SinhaAdobe EmployeeResposta
Adobe Employee
May 7, 2022

Hi @sankar07 ,

I can see there are multiple 302 redirects happening which is not needed. Try below rules and modify as per your need. 1st to make sure the redirection is to https and 2nd one to append /content/brand. More [R] redirects are not needed in my opinion. You can have PT flag instead:-

RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^/?$ https://brand.com%{REQUEST_URI} [L,R]

RewriteCond %{HTTP_HOST} ^brand.com$ [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^/$ https://brand.com/en/landingpage [R=301,L] RewriteCond %{REQUEST_URI} !^/apps RewriteCond %{REQUEST_URI} !^/content RewriteCond %{REQUEST_URI} !^/etc
RewriteCond %{HTTP_HOST} brand.com RewriteRule ^/(.+) /content/brand/in/$1 [PT,L,NC]