05-02
#1 서브디렉토리 사용시
05-02
Tasks

서브 디렉토리 사용시 backend 단에도 서브디렉토리 똑같이 붙여야함

  1. FRONTEND

1.1. \client\views\common\defaultAxios.js

    baseURL: '/', 
    수정 ex)  baseURL: '/biManager',

1.2. \client\views\pages\AppRouter.js

    const AppRouter = createRouter({ history: createWebHistory(), routes, });  
    수정 ex ) const AppRouter = createRouter({ history: createWebHistory('/biManager'), routes, });

1.3. \webpack.config.js

     output: {
        path: `${BASE_DIR}/client/build`, // __dirname: webpack.config.js 파일이 위치한 경로
        filename: "bundle.js",
      },

    수정 ex )

     output: {
        path: `${BASE_DIR}/client/build`, // __dirname: webpack.config.js 파일이 위치한 경로
        publicPath: '/biManager/',
        filename: "bundle.js",
      },

1.4. \client\views\pages\openapi\OpenApiSelectListOne.vue // OPEN API 사용시

    getExportUrl: function () {
          this.systemURL = window.location.protocol + "//" + window.location.host;
        },

    수정 ex )

    getExportUrl: function () {
          this.systemURL = window.location.protocol + "//" + window.location.host+'/biManager';
        },
  1. BACKEND

2.1. \src\main\resources\application.properties

    server.port 밑에 추가 

    server.servlet.context-path=/biManager
  1. rewrite 사용시

     ex ) iis rewrite 기반으로 작성 nginx나 apache 사용시 수정해서 사용할 것 (iis에서 사용시 iis URL 재작성 모듈 및 arr(애플리케이션 요청 라우팅 모듈) 설치 필요)
     <rewrite>
         <rules>
             <!-- 프론트(Vue 정적 자원 + .page 요청)는 8080으로 -->
             <rule name="BiManager-Frontend" stopProcessing="true">
                 <match url="^biManager/.*\.(html|js|css|png|jpg|jpeg|gif|woff2?|ttf|eot|svg|page)$" ignoreCase="true" />
                 <action type="Rewrite" url="http://localhost:8080/{R:1}" />
             </rule>
    
             <!-- 나머지(API 요청 등)는 9090 백엔드로 -->
             <rule name="BiManager-Backend" stopProcessing="true">
                 <match url="^biManager/.*" ignoreCase="true" />
                 <action type="Rewrite" url="http://localhost:9090/biManager/{R:1}" />
             </rule>
         </rules>
     </rewrite>
Comment 0

Add a comment