default backend - 404 Apache with ssl

5/26/2020

I am pretty much new to apache. I am trying to use the apache official container to redirect the incoming traffic to below 2 pods Pod-1. To my own custom container(CC) (this is a http service). Pod-22. To cutomised rabbitmq container. I am exposing both 80 and 443 of apache. I am able to access my application which is running on Pod-1. But if I try to access using 80 (which is redirected to https[443]) i get default backend error. I have enabled the "mod_socache_shmcb.so", "mod_ssl.so" moduels and included my config file. Below is my config file.

<VirtualHost *>

    ServerName apachessl
    Redirect / https://apachessl/

</VirtualHost>

<VirtualHost *:443>
ServerName apachessl

SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off

SSLEngine on
SSLProtocol -ALL +TLSv1
SSLCipherSuite ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM
SSLCertificateFile /usr/local/apache2/conf/certificate.crt
SSLCertificateKeyFile /usr/local/apache2/conf/privateKey.key

ProxyPreserveHost On

KeepAlive On
MaxKeepAliveRequests 0
ProxyTimeout 600

SSLProxyEngine on

ProxyPass /ws wss://rmqssl-app-loc:15674/ws
ProxyPassReverse /ws wss://apachessl/ws

ProxyPass / http://my-apllication:6543/
ProxyPassReverse / https://apachessl/

    ErrorLog "logs/my_application_log"
    LogLevel error
-- SHC
apache
google-kubernetes-engine
kubernetes

2 Answers

5/26/2020

Please change -

ProxyPassReverse / https://apachessl/

To

ProxyPassReverse / http://my-apllication:6543/

and try again.

-- nikhildx
Source: StackOverflow

5/30/2020

If you are using it from kubernetes and receiving default backend 404 error ... it essentially means that the domain using which the request is landing to kubernetes ingress controller is not mapped to any of the ingress.

So what you need is to check when request on port 80 is redirected to 443, the url apachessl --> has one ingress mapped in ingress definition under specs .. something like -

spec:
  rules:
  - host: apachessl
    http:
      paths:
      - backend:
          serviceName: <<your-app-service-exposed-on-k8s>>
          servicePort: 80
        path: /
  tls:
    - hosts:
      - apachessl
      secretName: <<your-ssl-secret>>

Can you share your ingress definition, just to be clear what needs to be fixed.

-- nikhildx
Source: StackOverflow