Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

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

3 Replies

Avatar

Level 5

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 @fanindras, 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

Level 5

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