<p>I'm currently evaluating Knative but I've definitely find no way to use path instead of subdomain in the URL for accessing service.</p>
<p>By default, when creating an service, the URL is made like this: <a href="http://Name.Namespace.Domain" rel="nofollow noreferrer">http://Name.Namespace.Domain</a> and what I would like to have is something like this http://Domain/Namespace/Name</p>
<p>Does anybody knows if it is possible ?
Thanks in advance,</p>
<p>Cédric</p>

Cédric
<p>Knative uses subdomains rather than URL paths because the underlying container could handle many different URLs, and might encode requests with absolute URLs (which might point to a different function depending on deployment) or relative URLs (which would point within the current application).</p>
<p>If you want to map multiple Knative services under a single domain name, you can use an Ingress implementation or API server like <a href="https://github.com/knative/docs/tree/main/code-samples/serving/kong-routing-go" rel="nofollow noreferrer">Kong</a>, <a href="https://github.com/knative/docs/tree/main/code-samples/serving/knative-routing-go" rel="nofollow noreferrer">Istio</a>, or many others. You will need an HTTP router which can rewrite the <code>Host</code> header to point to the Knative Service's hostname in question; the default Kubernetes <code>Ingress</code> resource doesn't expose this capability.</p>
<p>If you choose to set this up, you'll also need to decide on a policy for mapping the URL paths: you could either strip the URL paths off when passing them to the Knative Service, or leave them present. It probably makes more sense to strip the URL paths off, since otherwise you'll end up needing to have a dependency between your application code and the <code>namespace</code> and <code>name</code> that you have chosen to deploy it at.</p>
<p>Other gotchas to watch out for:</p>
<ul>
<li>Since all the Knative Services are behind a single hostname, they'll share the same cookie domain, and could inadvertently stomp or poison each others cookies.</li>
<li>Absolute vs relative URL references, as I mentioned above. It's likely that your HTTP router doesn't have the ability to re-add the stripped URL prefix on outbound paths; doubly so if you have URLs which are being constructed in HTML or Javascript, rather than simply in URL headers.</li>
<li>Automatically programming your HTTP router as new Services are created is not automated -- you'd need to do this yourself. You <em>could</em> also write a Knative Service to do this routing and use a <a href="https://knative.dev/docs/serving/services/custom-domains/" rel="nofollow noreferrer"><code>DomainMapping</code></a> to map that one Knative Service to your desired domain name. The Knative Service could then automatically do the URL rewriting, and you could do the reverse rewriting on the outbound if you wanted.</li>
</ul>
