Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Dispatcher redirecting requests from https:// to http:// and then again to https://

Avatar

Community Advisor

Hi All,

 

I have the below set of dispatcher configuration in place - 

 

1. VHost File - 

<VirtualHost *:80>

 

2.  Rewrite Rule - 

# Add .html extension when extension is missing from request
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.]*[^./])$ $1.html [R=301,L]

 

On testing this rule its working fine as seen below - 

rohangargTA_0-1660144415547.png

 

However, when running it on my development cloud server, the logs are generated as follows - 

https://brandA.com/content/brandA/us/en/home

http://brandA.com/content/brandA/us/en/home.html

https://brandA.com/content/brandA/us/en/home.html

 

As you can see there is a https:// to http:// redirection happening with 301 status in the network XHR.

 

Can you please suggest what might be causing this scheme change ?

@arunpatidar , @Albin_Issac , @Jörg_Hoh 

 

Thanks,

Rohan Garg

1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi @Rohan_Garg ,

Please keep in mind, always check this kind of situation by following below steps:


- bypass the CDN and check the domain url, where it's landing.
- Check the logs. 

Now, as per the description from your end, the domain is listening dispatcher in port 80, means it's http. Then it's resolving internally to https and delivering the final url to https. That's why your XHR tab showing you the redirection to http in middle.

To get rid of in between redirection, add the url https://<your_domain_url> into your server name or server alias in virtual host. Your problem should be solved.

If still it's coming provide the output of :-

- result of page after bypassing CDN, i,e from dispatcher.
- your virtual host initial entries (virtual host with  server name and alias).



View solution in original post

5 Replies

Avatar

Employee Advisor

@Rohan_Garg Please check if your SSL certificate is breaking before apache, and if the request coming to apache is with HTTP protocol.

In this case, you need to implement your 301 rules with HTTPS protocol

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.]*[^./])$ https://%{SERVER_NAME}/$1.html [R=301,L]

* Check if SERVER_NAME name return the correct hostname, otherwise check other variables [1]

 

[1] https://httpd.apache.org/docs/current/expr.html

Avatar

Community Advisor

@Mohit_KBansal - The SSL Certificates are already installed in publish and dispatcher as confirmed by the Domain Settings tab.

rohangargTA_0-1660155794803.png

Ideally if the request from browser is hit in https:// and the dispatcher has SSL certificate installed, doesn't it ensure that the request is passed in https:// format to dispatcher all the way as SSL is attached to the environment which has Publish Service (AEM & Dispatcher)
The only thing coming in between is Cloud CDN.

How can we check where the SSL certificate is breaking ?

Avatar

Employee Advisor

Check how the origin domain CDN is used to connect to Apache? Is it with http or https?

Avatar

Correct answer by
Level 3

Hi @Rohan_Garg ,

Please keep in mind, always check this kind of situation by following below steps:


- bypass the CDN and check the domain url, where it's landing.
- Check the logs. 

Now, as per the description from your end, the domain is listening dispatcher in port 80, means it's http. Then it's resolving internally to https and delivering the final url to https. That's why your XHR tab showing you the redirection to http in middle.

To get rid of in between redirection, add the url https://<your_domain_url> into your server name or server alias in virtual host. Your problem should be solved.

If still it's coming provide the output of :-

- result of page after bypassing CDN, i,e from dispatcher.
- your virtual host initial entries (virtual host with  server name and alias).



Avatar

Community Advisor

@tb1687196 - Thanks for your response. I will check with updating the ServerName and ServerAlias to https://

Meanwhile one query, if the domain is listening to dispatcher at port 80 is the issue, then shouldn't we upgrade the vhost configuration to both 443 and 80 ports ?

This will ensure that http:// request is handled at 80 and https:// at 443