Inconsistent path interpretation for culture prefixed items in Content Delivery API?

Let me explain two setups to illustrate my question. This is with Umbraco 17.1.0.
Both setups has two cultures, default culture is sv-SE and second culture is en-US.

Content tree has a main start page and one subpage.

Setup 1:

Main node’s “Culture and hostnames” is set to:

Using Content Delivery API I can request for the swedish and english subpage:

GET http://localhost:8080/umbraco/delivery/api/v2/content/item/undersida with Accept-Language set to sv-SE = HTTP 200 :white_check_mark:

GET http://localhost:8080/umbraco/delivery/api/v2/content/item/en/subpage with Accept-Language set to en-US = HTTP 200 :white_check_mark:

In other words this works fine and the subpage’s route is undersida and subpage respectively, but given the english prefix the english subpage item route is actually /en/subpage:

Swedish:

English:

Setup 2:

I define a specific domain name to the main node under cultures and hostnames:

Content delivery now returns different results:

GET http://localhost:8080/umbraco/delivery/api/v2/content/item/undersida with Accept-Language set to sv-SE = HTTP 200 :white_check_mark:

GET http://localhost:8080/umbraco/delivery/api/v2/content/item/en/subpage with Accept-Language set to en-US = HTTP 404 :cross_mark:

HOWEVER if I change the path to “only” /subpage (so essentially removing the culture prefix):

GET http://localhost:8080/umbraco/delivery/api/v2/content/item/subpage with Accept-Language set to en-US = HTTP 200 :white_check_mark:

Looking at the Info panel for the given pages I still have the exact same urls in the “Links” box.
Meanwhile the result when I do get the actual page response, the cultures section always tell the same exact story:

"cultures": {
    "sv-SE": {
        "path": "/undersida",
        "queryString": null,
        "startItem": {
            "id": "caab093e-75d1-4388-8ea7-2a4a8e284084",
            "path": "startsida"
        }
    },
    "en-US": {
        "path": "/en/subpage",
        "queryString": null,
        "startItem": {
            "id": "caab093e-75d1-4388-8ea7-2a4a8e284084",
            "path": "startpage"
        }
    }
}

To me this indicates that the path for the english page should still be /en/subpage, yet the page is NOT available at that path. Instead I have to strip out whatever prefix to the path happens to be defined in the cultures and hostnames section.
But only if the prefix is including a domain.

Is this expected? Am I missing something in the setup? It seems quite brittle to have a proper path to request documents from via the API when the cultures section says I can access a page given a path but it will return 404 on that path.

Is this perhaps a bug?

1 Like