***NOT WORKING: Ingress path based routing
===Issue I do not understand what is the point of having ingress if it's nearly impossible to put an application under a domain path. Like domain.com/nextcloud . Putting nextcloud on domain.com is easy, sub.domain.com also easy, but on domain.com/nextcloud is nearly impossible.
is it not the main purpose to have helm so we can deploy these apps pretty easilly? And have API or ingress so we can put these apps under URL paths?
===Expectation Easy working method to put nextcloud under domain.com/nextcloud
===Error Any way I try it, it always gives some error...
===What was tried Tried solutions from half the internet. A variety of rewriting rules, ingress config in this helm, separate ingress config. Literally not 1 thing works
===Questioning Why make applications so difficult. Why is it not the norm to have 1 easy setting to have the app at whatever path we want. I see only unnecessary complication.
- This is community supported and we are trying to do our best, but it's impossible to get everything 100% perfect
- Nobody wants to prevent any way of deploying Nextcloud. I agree that using a path should work, but probably not a lot of people use it this way (via the helm chart) so it's less tested.
- Please provide exact context and error messages. The issue template includes a lot of the information that is required for debugging such issues. Please always follow the issue templates if possible.
- Please don't try to blame anyone for the fact that you couldn't get it working. You could try providing examples of what failed using which config instead of just saying that the chart is bad.
Thanks for the heads up. I understand. It just boils me to see such a complex app, but the most basic thing not working. I seen forums online regarding path based routing - the whole internet is boiling on this stuff.
I can't honestly remember in detail the stuff I tried. But if anybody will ever test this, the most basic setup like this just does not work.
===Basic deployment helm upgrade nextcloud nextcloud/nextcloud -n nextcloud --install --create-namespace helm upgrade nextcloud nextcloud/nextcloud -n nextcloud -f a.yaml a.yaml: nextcloud: password: changeme host: minikube.local trustedDomains: minikube.local service: type: ClusterIP ingress: enabled: true annotations: {} path: /nextcloud
===Error I would expect the app to be on path /nextcloud. Well, browsing there you get error 404.
It just boils me to see such a complex app, but the most basic thing not working.
I get that. Setting up a helm chart, especially if you're new to the nextcloud or k8s ecosystem, can really push your buttons, but just remember we're human volunteers doing our best. All the people you see here making PRs and working to fix issues are all unpaid volunteers doing this in their off hours. Please see the nextcloud code of conduct for more info.
I can't honestly remember in detail the stuff I tried. But if anybody will ever test this, the most basic setup like this just does not work.
A lot of people currently use this helm chart, or are testing it to make it better.
I would expect the app to be on path /nextcloud. Well, browsing there you get error 404.
Now onto your values.yaml, it's a little hard to see if your yaml file is formatted correctly. Could you paste it in using a syntax highlighted code block using ``yaml on the line before the code block and ``` on the line aftterwards? Example instructions are here. The reason I'm asking you to do that is if your yaml is not indented properly like you have above, it will not work. See this as an example of how your code could be highlighted, but this will not work:
nextcloud:
password: changeme
host: minikube.local
trustedDomains: minikube.local
service:
type: ClusterIP
ingress:
enabled: true
annotations: {}
path: /nextcloud
This is properly formatted yaml:
nextcloud:
password: changeme
host: minikube.local
trustedDomains: minikube.local
service:
type: ClusterIP
ingress:
enabled: true
annotations: {}
path: /nextcloud
To reference a value of the yaml that spans multiple lines and indentation, like the ingress path, you would say, "I'm having trouble with the ingress.path option".
I haven't tested this via minikube before and I don't think too many people do 🤔 A lot of folks use k3d or kind these days, because both are more cross platform compatible.
Here's some stuff to try and think about though:
-
Does this chart work when you set only
nextcloud.hostto something likecooldomainfordogs.comand then do not set an ingress path? -
are you sure ingress is working with other apps you try, like could you give an example?
-
you showed two helm commands, can you try with just:
helm install nextcloud-release-name nextcloud/nextcloud -n nextcloud --create-namespace -f values.yaml
- are you able to get this working on kind? If you're not familiar with kind, you can learn about it here: https://kind.sigs.k8s.io/docs/user/ingress/
Answers with *** below
On Thu, 4 May 2023 at 15:05, JesseBot @.***> wrote:
It just boils me to see such a complex app, but the most basic thing not working.
I get that. Setting up a helm chart, especially if you're new to the nextcloud or k8s ecosystem, can really push your buttons, but just remember we're human volunteers doing our best. All the people you see here making PRs and working to fix issues are all unpaid volunteers doing this in their off hours.
I can't honestly remember in detail the stuff I tried. But if anybody will ever test this, the most basic setup like this just does not work.
A lot of people currently use this helm chart, or are testing it to make it better.
I would expect the app to be on path /nextcloud. Well, browsing there you get error 404.
Now onto your values.yaml, it's a little hard to see if your yaml file is formatted correctly. Could you paste it in using a syntax highlighted code block using 3 backticks and then the word yaml? Example instructions are here https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks#syntax-highlighting. The reason I'm asking you to do that is if your yaml is not indented properly like you have above, it will not work. See this as an example of how your code could be highlighted, but this will not work:
nextcloud:password: changemehost: minikube.localtrustedDomains: minikube.localservice:type: ClusterIPingress:enabled: trueannotations: {}path: /nextcloud
This is properly formatted yaml:
nextcloud: password: changeme host: minikube.local trustedDomains: minikube.localservice: type: ClusterIPingress: enabled: true annotations: {} path: /nextcloud
***It is properly formatted yes, I got some professional helm experience. It works super well with path /
To reference a value of the yaml that spans multiple lines and indentation, like say, the ingress path, you would say, "I'm having trouble with the ingress.path option".
I haven't tested this via minikube before and I don't think too many people do 🤔 A lot of folks use k3d or kind these days, because both are more cross platform compatible.
Here's some stuff to try and think about though:
Does this chart work when you set only nextcloud.host to something like cooldomainfordogs.com and then do not set an ingress path?
***Works well with such stuff yes
are you sure ingress is working with other apps you try, like could you give an example?
***This is nextclouds helm own ingress. It does work with path /
you showed two helm commands, can you try with just:
helm install nextcloud-release-name nextcloud/nextcloud -n nextcloud --create-namespace -f values.yaml
***Indeed recently I have redone this, with 1 command like that. Same issue. Path option really works only with /
- are you able to get this working on kind? If you're not familiar with kind, you can learn about it here: https://kind.sigs.k8s.io/docs/user/ingress/
***I don’t think it’s an issue with a solution. It’s an ingress issue. I seen loads of people complaining online about nextcloud path not working. Out of 4 hours reading, I seen nobody running it on domain.com/nextcloud . All do on domain or subdomain directly
—
Reply to this email directly, view it on GitHub https://github.com/nextcloud/helm/issues/390#issuecomment-1534748229, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABA2MAJAXENB6NT5ZGMRDD3XEOSSRANCNFSM6AAAAAAXSAK6BY . You are receiving this because you authored the thread.Message ID: @.***>
seen loads of people complaining online about nextcloud path not working.
But that is probably with another installation method than the Helm chart?
@marksaitis Could you please login to github.com and use the interface here to respond? Replying via email makes it hard to read your replies, because they are not formatted properly. If you formatted your responses with proper markdown, more people would be able to chime in and help at a glance. Without doing that, it's going to be harder to help.
***It is properly formatted yes, I got some professional helm experience.
Since you've got some professional helm chart experience, can you see if there's any issues in our ingress template here: https://github.com/nextcloud/helm/blob/a215de8e0cafd940818b888e94806a387500abc4/charts/nextcloud/templates/ingress.yaml#L24-L30
If there isn't, then I guess the next thing would be checking if it's still a problem on a different distribution of k8s?
Out of 4 hours reading, I seen nobody running it on domain.com/nextcloud. All do on domain or subdomain directly
I do agree though, that most people will use a domain or subdomain to get this working. It's a little unusual to use /nextcloud as your ingress path, because this is a large scale app. It itself has many paths, so you'd end up with URLs like domain.com/nextcloud/login, which would look a little strange. Routes are generally used for single page apps. Still, it should work.
===Error Any way I try it, it always gives some error...
I need to know exactly your setup and the exact error you get. If someone has time to test locally, that would be awesome, at least until we revise our ci/cd to test on a variety of different k8s solutions. Right now it tests on kind, but just the default settings in the values.yaml.
The real problem is not Nextcloud. It's just that you don't fully grasp how Kubernetes Ingress controllers work, though to be fair they can be a beast to understand. The ingress manifest here is laid out like any other manifest in any other helm chart you will find, there is nothing wrong with it, you just need to configure it properly.
What is really happening is the Kubernetes ingress is making users type in the url http://yourIpAddress/nextcloud but when the nextcloud sees that URL, nextcloud is only expecting traffic at "http://yourIpAddress/", and therefore it doesn't work and gives a 404 because it has no idea what /nextcloud means.
There are 2 ways to fix this:
- Set your application's configuration to have a
baseURLorbasePathof/nextcloud. However, I'm not sure if this is possible in Nextcloud, which brings us to the next point: - Use URL re-writes to make Nextcloud think it's getting traffic at "/", but it's actually at "/nextcloud".
So, let's use option 2 because I have no idea if the first option is possible with Nextcloud. If you are using an nginx ingress controller, you can do it like this in the values.yaml of this chart:
ingress:
enabled: true
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$2
path: /nextcloud(/|$)(.*)
This is also well documented and quite easy to understand. If you are using a different ingress provider (not nginx) you are going to have to do some footwork yourself to figure out how to do this with your ingress controller, but I assure you, this helm chart is working.
@QuinnBast Please stay friendly and consider the Code of Conduct (https://nextcloud.com/contribute/code-of-conduct/) when commenting. Could you please rephrase your comment to be more friendly towards the people in this issue, thank you.
I thought it was fairly friendly -- But I've updated it :upside_down_face:
The real problem is that you don't understand how Kubernetes Ingress controllers work.
Still quite aggressiv against people trying to solve a problem here.
The real problem is not Nextcloud. The real problem is actually that you don't understand how Kubernetes Ingress controllers work. The ingress manifest here is laid out like any other manifest in any other helm chart you will find. There is nothing wrong with it. Instead of taking time to figure out how get ingress to work how you want it to, you blame it on nextcloud not functioning properly.
I haven't even used this helm chart before and I can tell you that the ingress is working. You just need to configure it properly. Read your ingress controller's documentation on URL rewrites. What is really happening is that the kubernetes ingress is making users type in the url
http://yourIpAddress/nextcloudbut when the nextcloud sees that URL, nextcloud is only expecting traffic at "http://yourIpAddress/", and therefore it doesn't work and gives a 404 because it has no idea what/nextcloudmeans.There are 2 ways to fix this:
- Set your application's configuration to have a
baseURLorbasePathof/nextcloud. However, I'm not sure if this is possible in Nextcloud, which brings us to the next point:- Use URL re-writes to make Nextcloud think it's getting traffic at "/", but it's actually at "/nextcloud".
So, let's use option 2 because I have no idea if the first option is possible with Nextcloud. If you are using an
nginxingress controller, you can do it like this in thevalues.yamlof this chart:ingress: enabled: true annotations: nginx.ingress.kubernetes.io/use-regex: "true" nginx.ingress.kubernetes.io/rewrite-target: /$2 path: /nextcloud(/|$)(.*)Note that if you had taken the time to understand your ingress controller and how to actually use it properly, this behaviour is also well documented and quite easy to understand. If you are using a different ingress provider (not
nginx) you are going to have to do some footwork yourself to figure out how to do this with your ingress controller, but I assure you, this helm chart is working.So to summarize:
- You complain about not understanding how Ingress works
- You provide no reproducible code/deployment to allow creators to debug/support you until after you were asked for it
- You claim you've used many online sources but didn't look at the Ingress controller's official documentation to understand how it works
- And then proceed to blame the chart creators for your own misunderstanding
@QuinnBast I don’t agree with you.
- Purpose of helm charts is to be able to deploy apps easily, without big understanding how things work behind. I think we can agree that it is very common to choose endpoint url where a deployed app sits. Like app.domain.com and domain.com/app . So why leave out 2 most common deployments out of README documentation? Boggles my mind .
- I spent multiple hours trying a variety of different methods, including the one you wrote here. None of it works. I shows me that you are writing without testing or knowing things yourself and assuming. Either way, thanks for your time.
Sorry, but I got it working in just a few minutes. I had to play around with the trusted_domains not working quite like I expected, but the ingress itself would take me to nextcloud as I would expect.
Here's how I did it:
values.yaml:
nextcloud:
# For some reason, this value sets the `ingress.host` and also sets the `trusted_domains`.
# Because of this, we need to overwrite the `trusted_domains` with our own config file below...
# Set this to "*" to work with the ingress host
host: "*"
# Enable ingress like I said above...
ingress:
enabled: true
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$2
path: "/nextcloud(/|$)(.*)"
pathType: ImplementationSpecific
# We need to update the "host" and "baseUrl" for the app.
# Add a new config.php file that overwrites these.
# Set "overwritehost" to your IP address (or DNS name)
# Set "overwritewebroot" to the path you want nextcloud served from
configs:
ingress.config.php: |-
<?php
$CONFIG = array (
'overwritewebroot' => '/nextcloud',
'overwritehost' => '172.29.127.27',
);
@QuinnBast I remember I got it working up to login screen. But not past that. You sure it works further? If it does, somebody should add this to deployment guide
Looks like it does:
I've never actually used nextcloud so I'm not sure what else to test but seems to work with the config I posted above if you want to give that a shot :)
@QuinnBast thats good work. Just do some browsing in admin page area and around. If all works - then this is it and we can close. Hopefully will be helpful for many other people I seen struggling with this as well on forums.
somebody should add this to deployment guide
After you've done your own testing, please feel free to submit PRs to update anything in the README that you think would help bring clarity to alternative methods of ingress configuration.
We can close this. I've been using Nextcloud behind an ingress for the past 3-4 months with success using the config I posted above.
We could maybe update the documentation to indicate how to do this as there are some nuances (like setting the ingress host to "*") that might not be obvious