rexlow opened a new issue, #2873:
URL: https://github.com/apache/apisix-dashboard/issues/2873

   ### Issue description
   
   We have a requirement that requires modification on APISIX Dashboard. This 
requirement basically calls upon a backend API hosted in another server. 
   
   On local, we are able to configure the proxy object to forward all requests 
to `/external-api` to the actual destination. However, in the production build 
(generated by `umi build`), the proxy doesn't seems to be working.
   
   Through my tests, it seems like the proxy solution only works for non 
production build. I am suspecting there is another interim proxy approach 
within the `manager-api`. Appreciate if anyone could shed some light!
   
   ### Expected behavior
   
   In production build, the custom API request is able to resolved properly.
   
   ### How to Reproduce
   
   1. Modify the dashboard to call a REST API with route 
`/external-api/facebook` 
   2. Modify the proxy object under `web/config/config.ts` to include that 
proxy behaviour (for example to include https://facebook.com).
   3. Run locally to verify that it is working.
   4. Docker build and deploy to production.
   
   ### Screenshots
   
   <img width="1249" alt="Screenshot 2023-10-27 at 8 18 00 PM" 
src="https://github.com/apache/apisix-dashboard/assets/7680796/997df4b0-d6f0-4720-940b-fac9b66d07ad";>
   
   
   ### Environment
   
   - apisix version (cmd: `apisix version`): 2.13
   - OS (cmd: `uname -a`): Linux / macOS 14.0
   - OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`): 
   - etcd version, if have (cmd: run `etcd --version`):
   - apisix-dashboard version, if have: 2.13
   - Browser version, if have:
   
   
   ### Additional context
   
   Currently this is the config on my `web/config/config.ts`
   
   ```
   const config = {
     hash: true,
     antd: {},
     dva: {
       hmr: true,
     },
     locale: {
       default: 'en-US',
       antd: true,
       baseNavigator: true,
     },
     dynamicImport: {
       loading: '@/components/PageLoading/index',
     },
     targets: {
       ie: 11,
     },
     routes,
     layout: {
       name: 'APISIX Dashboard',
       locale: true,
       logo: '/favicon.png',
     },
     base: '/',
     publicPath: '/',
     define: {
       REACT_APP_ENV: REACT_APP_ENV || false,
     },
     // Theme for antd: https://ant.design/docs/react/customize-theme-cn
     theme: {
       'primary-color': defaultSettings.primaryColor,
     },
     // @ts-ignore
     title: false,
     ignoreMomentLocale: true,
     proxy: {
       ..._proxy,
       '/external-api': {
         // NOTE: This is the manager-api pre-deployed in Azure just for 
preview, please refer to https://www.yuque.com/umijs/umi/proxy for more info.
         target: 'http://37.220.10.101', // example destination ip
         changeOrigin: true,
         pathRewrite: { '^/external-api': '' },
         logLevel: 'debug',
       },
     },
     manifest: {
       basePath: '/',
     },
     outputPath: '../output/html',
     extraBabelPlugins: [
       [
         'babel-plugin-istanbul',
         {
           exclude: ['**/.umi', '**/locales'],
         },
       ],
     ],
   };
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to