AEM: Using Reverse Proxy - Dispatcher | Community
Skip to main content
Level 2
March 23, 2022
Solved

AEM: Using Reverse Proxy - Dispatcher

  • March 23, 2022
  • 2 replies
  • 5995 views

Hello,

 

  Could you please let me know how can we use reverse proxy to allow non aem server to post pages to a directory on the main domain on AEM site (Eg: www.yourdomainname.com/test-one)?

I have tried adding the below syntax in the vhost file in dispatcher module of Apache server for using reverse proxy. However, this didn't work and faced a 404 on dispatcher upon server restart. The reason might be dispatcher reverse proxies to the publish instance. How can we bypass this issue to setup reverse proxy?

 

<VirtualHost *:80>

        ServerName www.yourdomainname.com

        ProxyRequests off

        RemoteIPHeader X-Forwarded-For

        Header set  xxx-Proxy-Version "1.0"

        ProxyPreserveHost On

        <Location /test-one >

                ProxyPass "http://xxx/test-one"

                ProxyPassReverse "http://xxx/test-one"

                Order allow,deny

                Allow from all

        </Location>

        <Location /test-one/(.*) >

                ProxyPass "http://xxx/test-one/(.*)"

                ProxyPassReverse "http://xxx/test-one/(.*)"

                Order allow,deny

                Allow from all

        </Location>

        </VirtualHost>

 

Thanks,

Ram

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Fanindra_Surat

Hi @ramtejareddy  - I would say, maybe you can enable the debug logging and check if the path is being proxied correctly.

2 replies

Fanindra_Surat
Community Advisor
Community Advisor
March 23, 2022

Hi @ramtejareddy ,

 

Can you try changing the lines

                ProxyPass "http://xxx/test-one"

                ProxyPassReverse "http://xxx/test-one"

to 

                ProxyPass "/" "http://xxx/"

                ProxyPassReverse "/" "http://xxx/"
Since your location is already set to "/test-one", this proxy rule should apply only to the URLs with /test-one in the path.

 

Also, For regex pattern like /test-one/(.*), you should use LocationMatch directive:
Ref: https://httpd.apache.org/docs/2.4/mod/core.html#locationmatch

 

Hope this helps!

 

Thanks,

Fani

 

Level 2
March 24, 2022

Hi @fanindra_surat, thanks for your response. Unfortunately, this didn't work. The server restart failed and got an 404 on dispatcher. The reason here is by default, dispatcher reverse proxies to publish instance. Pls let me know if you have a solution/alternatives?

 

Thanks,

Ram

Fanindra_Surat
Community Advisor
Fanindra_SuratCommunity AdvisorAccepted solution
Community Advisor
March 24, 2022

Hi @ramtejareddy  - I would say, maybe you can enable the debug logging and check if the path is being proxied correctly.

September 30, 2022

Were you able to resolve it? I am trying to achieve the same functionality and I am facing the same issue than you

Level 2
June 26, 2023

Hi, 

 

We are also looking for the same, any solutions for this ?

 

Thanks

Raviteja K