0

Docker, httpd and tomcat is new to me.

What I want to do: Access tomcat servlet through httpd ajp reverse proxy.

I am making two containers under same bridge network, one runs httpd, another tomcat.

Problem: I can not access tomcat through httpd. Httpd returns 403 error. I can access through port 8080 if I expose it to the host. I have read many articles but do not understand what I am doing wrong. Current configuration should work according to my understanding but surely I am missing something.

Screenshot of error page

Kindly give me pointers what am I doing wrong.

My configurations and dockerfiles Please see the Git repository here. I run the container by first creating image and run by following

# Start web container
docker run -dit --name httpd.container -p 80:80 --network extope-network httpd-101-image
# Start AP container
docker run -dit --name tomcat.container -p 8080:8080 --network extope-network --add-host=host.docker.internal:host-gateway tomcat-101-image
Gerald Schneider
  • 23,274
  • 8
  • 57
  • 89

2 Answers2

0

Your server.xml redirects traffic to port 8443, but,

  1. doesn't handle that port (the handler is commented out)
  2. the container doesn't accept traffic for that port.

In the httpd.conf I see "Include conf/httpd_extope.conf", but there is no httpd_extope.conf. The http_proxy.conf tries to contact the container on port 8009, for which the above two remarks are also valid.

Gerard H. Pille
  • 2,569
  • 1
  • 13
  • 11
0

Remove the quotes from the secret in your httpd config.

ProxyPass "/docs" "ajp://tomcat.container:8009/docs" secret=test_ajp_secret
ProxyPass "/manager/" "ajp://tomcat.container:8009/manager/" secret=test_ajp_secret

Afterwards it works.

Gerald Schneider
  • 23,274
  • 8
  • 57
  • 89