problem running app alongside http-proxy-middleware reverse proxy



  • I am having trouble getting my app running. I am using a different app as a simple http-proxy-middleware reverse proxy.

    Here is the config.json for the proxy:

    {
      "routes": [
        {"route": "/apache"         , "address": "http://localhost:8081"},
        {"route": "/basicAuthApp"   , "address": "http://localhost:4000"},
        {"route": "/codeRefBackend" , "address": "http://localhost:3000"},
        {"route": "/codeRefFrontend", "address": "http://localhost:3001"}
      ]
    }
    

    All my other apps are running fine but they are simply backend stuff. My quasar app is the one running on port 3001.

    In the quasar documentation https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-devServer it says:
    “Note: if you’re proxying the development server (i.e. using a cloud IDE), set the public setting to your public application URL.”

    With that in mind I have made this modification to quasar.conf.js:

        devServer: {
          https: false,
          port: 3001,
          open: false, // opens browser window automatically
          public: 'http://localhost/codeRefFrontend'
        },
    

    The app runs properly if I go to http://localhost:3001/ but if I go to http://localhost/codeRefFrontend/ the app doesn’t load.

    When I look at the source I see this code:

    <script type="text/javascript" src="app.js"></script><script type="text/javascript" src="vendor.js"></script></body>
    

    Both app.js and vendor.js are pointing to http://localhost/app.js and http://localhost/vendor.js . This, of course, is not correct. They should be pointing to http://localhost/codeRefFrontend/app.js and http://localhost/codeRefFrontend/app.js .

    I’ve been racking my brain trying to figure out how to tell the app to add the extra bit to the path.

    If anyone can point me in the right direction I would really appreciate it!!