Score:0

apache "Options Indexes" working localhost but not with public DNS name

jp flag

I have a Kubernetes cluster and a very basic container. I am trying to access it through the internet and the task is very simple, I just need to list the index of the directory. Here is my basic virtual host configuration:

<VirtualHost *:80>
 Alias /docs /mnt/nfs
 <Directory /mnt/nfs>
  DAV Off
  Options Indexes FollowSymLinks MultiViews
  AllowOverride All
  Require all granted
 </Directory>
</VirtualHost>

When I use the service or pods with the kubectl port-forward option, it is working as expected and my files are listing with xyz.com/docs. However, when I try to access the pod via ingress through my FQDN, it gives me a 404 error. When I access a test.txt file that is inside the folder, I can see the content of the file but it is not listing the indexes like it is working with the port-forwarding option. so in short i can reach pod and access the files but can not list them with autoindex module and with same pod i am able to list index with kubectl port-forwarding option

kind: Ingress
metadata:
  name: webdav-app
  namespace: testing1
  annotations:
    cert-manager.io/issuer: "letsencrypt-staging"
    #cert-manager.io/cluster-issuer: "letsencrypt-prod"
    traefik.ingress.kubernetes.io/router.entrypoints: websecure
    traefik.ingress.kubernetes.io/router.tls: "true"
spec:
  tls:
    - hosts:
      - webdav.xyz.com
      secretName: webdav-app-certificate
  rules:
    - host: webdav.xyz.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: webdav-app
                port:
                  number: 80

Any help would be highly appreciated.

Thanks,

in flag
In your port-forward test, did you provide a `-H "host: webdav.xyz.com"` to more closely replicate the VirtualHost part? Did you already increase the apache logging to see what it thinks is going on?
user3852599 avatar
jp flag
Yes with -H i tried Curl and it seems giving me the expected result with no 404. I believe the issue is with Ingress. the way ingress communicates with the service. which I want to understand with some expert help like yourself. Because when I delete the service and pods Ingress gives me the same 404 page not found. error as described earlier even with the pods running. so the error is coming from ingress, i check the logs of traefikv2 ingress but there is nothing in the logs like 404. i am not sure where can i look for the missing piece of puzzle.
in flag
Well, I wouldn't expect the traefik logs to be impactful, I meant the Apache logs since it is the one that is ignoring your VirtualHost configuration, AIUI. Anyway, you may get more help by [editing your question](https://serverfault.com/posts/1129208/edit) and *showing* the results of your debugging, since words are just works but logs are life
Score:0
jp flag

Okay, the solution for me was a workaround. I noticed that the "webroot" folder (/var/www/html) could be accessed in the same way I wanted to access the WebDAV folder (e.g., xyz.com/doc). So, I created a symlink at the root folder as /var/www/html/doc, and the doc symlink is pointing to the required doc folder. The option FollowSymLinks is also enabled in the config, which allowed it to work for me.

However, I am still not sure why it works in this way with FQDN.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.