1

There are two services on the server's two ports 192.168.0.42 in the LAN.

  • 80 - wordpress with blog
  • 8080 - java application (chat)

Domain redirected to router which forwards traffic from 80 and 443 to Apache Reverse Proxy dedicated host in LAN (192.168.0.2).

I would like example.com to open 192.168.0.42:80 and example.com/chat to open 192.168.0.42:8080. At the moment example.com opens perfectly wordpress and example.com/chat opens the application, but each link placed in the application (192.168.0.42:8080) is redirected to example.com (192.168.0.42:80), graphics and styles are not loaded either.

The example.com.conf file on the proxy looks like this:

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    
    ProxyRequests Off
    ProxyPreserveHost On

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    ProxyHTMLExtended On

    <Location /chat>
 
        ProxyPass         http://192.168.0.42:8080/
        ProxyPassReverse  http://192.168.0.42:8080/
        AddOutputFilterByType SUBSTITUTE text/html
        Substitute "s|example.com/|example.com/chat/|i" 

    </Location> 

    ProxyPass        / http://192.168.0.42:80/
    ProxyPassReverse / http://192.168.0.42:80/

    ErrorLog ${APACHE_LOG_DIR}/chat-error.log
    CustomLog ${APACHE_LOG_DIR}/chat-access.log combined
</VirtualHost>

I know that the topic was dealt with in many different ways on this forum. I think I checked most of the solutions, but none of them led to the correct display of example.com/chat. I would be very grateful for the suggestion of what else I can try. Of course, I do not insist that it should be done as I put it in the code, if anyone has any other suggestion I will definitely use it. I am sorry for not submitting a post but I used the translator.

Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47
  • 1
    https://serverfault.com/a/561897/546643 offers a number of different strategies – Bob Nov 25 '20 at 11:40

0 Answers0