ui5-community / ui5-ecosystem-showcase

A repository showcasing the UI5 tooling extensibility to combine OSS tools for UI5 application development.
https://ui5-community.github.io/ui5-ecosystem-showcase/
Other
192 stars 93 forks source link

[ui5-middleware-simpleproxy 3.2.12] proxy url does not work in mockserver #954

Closed mengmengh2022 closed 8 months ago

mengmengh2022 commented 8 months ago

Describe the bug After updating the ui5-middleware-simpleproxy version from 0.9.0 to 3.2.12, the prory url does not work any more in FE mockserver.

Related setting in ui5.yaml:

server:
  customMiddleware:
    - name: ui5-middleware-simpleproxy
      mountPath: /com/sap/grc/lib/featuretoggles/features
      afterMiddleware: compression
      configuration:
        baseUri: http://localhost:3000/localService/featureToggles.json
        strictSSL: false

Package.json:

//...
  "devDependencies": {
    "@sap-ux/ui5-middleware-fe-mockserver": "2.2.25",
    "@sap/grunt-sapui5-bestpractice-build": "1.4.15",
    "@sap/ux-specification": "1.120.3",
    "@ui5/project": "3.9.0",
    "@ui5/cli": "3.9.0",
    "@ui5/fs": "3.0.5",
    "@ui5/logger": "3.0.0",
    "eslint": "8.56.0",
    "eslint-plugin-no-only-tests": "2.6.0",
    "grunt": "1.6.1",
    "grunt-zip": "0.20.0",
    "karma": "6.4.2",
    "karma-chrome-launcher": "3.2.0",
    "karma-coverage": "2.2.1",
    "karma-junit-reporter": "2.0.1",
    "karma-spec-reporter": "0.0.36",
    "karma-ui5": "3.0.4",
    "karma-webdriver-launcher": "1.0.8",
    "ui5-middleware-simpleproxy": "3.2.12",
    "puppeteer": "21.11.0",
    "xmlbuilder2": "3.0.2"
  },
  "ui5": {
    "dependencies": [
      "@sap-ux/ui5-middleware-fe-mockserver",
      "ui5-middleware-simpleproxy"
    ]
  }

To Reproduce Steps to reproduce the behavior:

  1. Start FE mockserver of app
  2. See error in console

Expected behavior The request to " /com/sap/grc/lib/featuretoggles/features" should be forwarded to local path " http://localhost:3000/localService/featureToggles.json"

Screenshots 2024-02-20 11_08_30-Process Issues

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

petermuessig commented 8 months ago

Hi @mengmengh2022 ,

since 0.9 and 3.0 the implementation of the simpleproxy has been changed completely. Can you try with the following mapping?

server:
  customMiddleware:
    - name: ui5-middleware-simpleproxy
      mountPath: /com/sap/grc/lib/featuretoggles/features/featureToggles.json
      afterMiddleware: compression
      configuration:
        baseUri: http://localhost:3000/localService/featureToggles.json
        strictSSL: false

Before - in the pre-releases 0.x versions - the mountPath to baseUri mapping wasn't always correct and some mappings worked just by accident.

HTH

mengmengh2022 commented 8 months ago

Hello @petermuessig, Thank for the suggestion, sadly this new mapping also does not work. This is the error in console: image image

And this is current setting in yaml: image

Thanks and best regads, Mengmeng

petermuessig commented 8 months ago

Hi @mengmengh2022

I found an issue in the mapping of mountPath to baseUri in the proxy implementation and will fix it with the following PR: https://github.com/ui5-community/ui5-ecosystem-showcase/pull/962

I release a new version in 10-20 mins - please validate with the latest version then...

mengmengh2022 commented 8 months ago

Hello @petermuessig, thank you for the fix, I confirm that it is now working with ui5-middleware-simpleproxy version 3.2.14. BR Mengmeng