AEM: Using Reverse Proxy - Dispatcher | Community
Skip to main content
Level 2
Mar 23, 2022 7:59 PM UTC
Solved

AEM: Using Reverse Proxy - Dispatcher

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.
Fanindra_Surat
Fanindra_SuratAccepted solution
New Participant
Mar 24, 2022 10:10 PM UTC

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

5 replies

New Participant
Sep 30, 2022 1:28 PM UTC

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

Translate
Level 2
Jun 26, 2023 6:42 AM UTC

Hi, 

 

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

 

Thanks

Raviteja K

Translate
Fanindra_Surat
New Participant
Mar 23, 2022 10:46 PM UTC

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

 

Translate
Level 2
Mar 24, 2022 1:49 PM UTC

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

Translate
Fanindra_Surat
Fanindra_SuratAccepted solution
New Participant
Mar 24, 2022 10:10 PM UTC

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

Translate