Code Monkey home page Code Monkey logo

Comments (5)

tomasherceg avatar tomasherceg commented on September 26, 2024 1

I was able to get it running with a combination of ingress (without rewriting) and UsePathBase:

ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: kubernetesvirtualdirectorytest-ingress
  labels:
    service: kubernetesvirtualdirectorytest
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - host: "kubernetesvirtualdirectorytest.local"
    http:
      paths:
      - path: /sub-app
        pathType: Prefix
        backend:
          service:
            name: kubernetesvirtualdirectorytest
            port: 
              number: 80

Startup.cs

...
app.UsePathBase("/sub-app");
app.UseRouting();
...

Are you using rewrite rule on the ingress to remove the /assessments segment? I think this would be the problem - the app needs to know it is running in a virtual directory so it would generate the URLs correctly.

from dotvvm.

tomasherceg avatar tomasherceg commented on September 26, 2024

It seems that DotVVM doesn't know that the URL rewriting in Ingress is happening.

Can you try calling UsePathBase and specify the "/assessments" so DotVVM will know on which "real" URL it is running?
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/proxy-load-balancer?view=aspnetcore-7.0#work-with-path-base-and-proxies-that-change-the-request-path

from dotvvm.

dleonardNetalytics avatar dleonardNetalytics commented on September 26, 2024

Thank you for the response,

I tried what you suggested and set the path base when running behind the ingress.
i also made sure that UsePathBase is being applied before the call to app.UseRouting as described in the msdn article.

` if (Configuration["Assessments:IngressPath"].Length > 0)
{
logger.LogCritical($"SETTING PathBase to {Configuration["Assessments:IngressPath"]}");
app.UsePathBase(Configuration["Assessments:IngressPath"]);
}

app.UseRouting();
`
I can tell that the call to UsePathBase is happening when running in kube because I can see my log entries being written.

'crit: Netalytics.Assessments.Frontend.Startup[0]
SETTING PathBase to /assessments
'
Unfortunately, when I go to the page it's still looking for the dotvvm--internal script without taking the path into account.
Its like UsePathBase didnt really affect it.

from dotvvm.

tomasherceg avatar tomasherceg commented on September 26, 2024

Thanks for the info, I'll try to reproduce it on my cluster.

from dotvvm.

exyi avatar exyi commented on September 26, 2024

I'm closing this, I assume it worked. Please reopen or open a new issue if the problem persists

from dotvvm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.