klustair / klustair-helm

Helm chart do deploy klustair with anchore
Apache License 2.0
7 stars 4 forks source link

How to use klustair behing ingress using subpath /klustair? #26

Closed hugodopradofernandes closed 3 years ago

hugodopradofernandes commented 3 years ago

How to use klustair behing ingress using subpath /klustair? The closest I got was this one, that returns unformated page and all links point to / not /klustair

Screenshot_20210722_194455

Ingress config:

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$2
  name: ingress-klustair
  namespace: klustair-scan
spec:
  rules:
  - http:
      paths:
      - backend:
          service:
            name: klustair-app-frontend
            port:
              number: 80
        path: /klustair(/|$)(.*)
        pathType: Prefix
mms-gianni commented 3 years ago

The problem is in Laravel it self. It is possible to serve from another subdir, but it is not that simple as expected.

It will need some changes in configuration of the Apache/NginX and Laravel.

https://lucabecchetti.medium.com/configure-laravel-to-work-in-a-subdirectory-and-with-artisan-serve-at-the-same-time-654ba0c1fd0b

mms-gianni commented 3 years ago

Well there is a cheaper solution, since your config seems to work except the assets.

The Laravel ENV var ASSET_URL changes the URL of the Assets.

So this should work for you: APP_URL=https://www.mydomain.com/klustair ASSET_URL=https://www.mydomain.com/klustair

This ENV var ist currently not part of the Helm charts.

hugodopradofernandes commented 3 years ago

I tried this, it works a bit better but some items and links still point to root URL and not subpath.... It also breaks if I try to access with port forward. We can close this item as Laravel is not made to work with subpath. Then I'll keep using port forward to access it.

kubectl port-forward --address 0.0.0.0 svc/klustair-app-frontend 8081:80