Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

AEM: Using Reverse Proxy - Dispatcher

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

View solution in original post

5 Replies

Avatar

Community Advisor

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

 

Avatar

Level 2

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

Avatar

Correct answer by
Community Advisor

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

Avatar

Level 1

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

Avatar

Level 2

Hi, 

 

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

 

Thanks

Raviteja K