Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-12813

Page Model API gives 500 in preview when X-Forwarded-Host is present

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • 14.3.0, 100.2.0
    • site-toolkit
    • None
    • 0.5
    • Quasar
    • Puma Sprint 227, Puma Sprint 230, Puma Sprint 231, Puma Sprint 242

    Description

      Context:
      When we run an SPA, we usually use a standalone cms host configuration with multiple channels. In this case, the SPA is running somewhere on a different host and requests the Page Model API served from another host.

      Way to Reproduce:
      1. Run the HAP.
      2. Go to the Experience Manager.
      3. Click on "React SSR SPA".
      4. Copy the JSESSIONID cookie for "/site" path.
      5. Open a terminal.
      6. Run the following command:

      curl -X GET \
        http://127.0.0.1:9080/site/_cmsinternal/spa-react-ssr/resourceapi \
        -H 'cookie: JSESSIONID=44053911553CB27FE45316592EBC35A8' \
        -H 'x-forwarded-host: spa.example.com'
      

      Actual::

      • 500 error is being returned.
      • The output from the CMS console:
        [INFO] [talledLocalContainer] 18.12.2019 13:00:22 WARN  http-nio-9080-exec-7 [HstDelegateeFilterBean.doFilter:511] Co│
        ntainerException for 'Request{ method='GET', scheme='http', host='127.0.0.1', requestURI='/site/_cmsinternal/spa-reac│
        t-ssr/resourceapi', queryString='null'}': org.hippoecm.hst.core.container.ContainerException: java.lang.IllegalArgume│
        ntException: Could not match cms host 'spa.example.com' in platform hst model (through reference chain: org.hippoecm.│
        hst.pagemodelapi.v09.core.model.ComponentWindowModel["components"]->java.util.LinkedHashSet[0]->org.hippoecm.hst.page│
        modelapi.v09.core.model.ComponentWindowModel["components"]->java.util.LinkedHashSet[0]->org.hippoecm.hst.pagemodelapi│
        .v09.core.model.ComponentWindowModel["components"]->java.util.LinkedHashSet[0]->org.hippoecm.hst.pagemodelapi.v09.cor│
        e.model.ComponentWindowModel["models"]->java.util.LinkedHashMap["document"])  
        

      Expected:

      • Page Model API should ignore `x-forwarded-host` header or return 404.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mdokolin Mikhail Dokolin (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: