tuon 1 year ago
parent
commit
a3c840b389

File diff suppressed because it is too large
+ 0 - 0
frontend/dist/assets/index-8a63c82a.js


+ 1 - 1
frontend/dist/index.html

@@ -4,7 +4,7 @@
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <title>NginxUI</title>
     <script type="application/javascript" src="./config.js"></script>
-    <script crossorigin="">import('/nginx-ui/assets/index-044fcdd9.js').finally(() => {
+    <script crossorigin="">import('/nginx-ui/assets/index-8a63c82a.js').finally(() => {
             
     const qiankunLifeCycle = window.moudleQiankunAppLifeCycles && window.moudleQiankunAppLifeCycles['nginx-ui'];
     if (qiankunLifeCycle) {

+ 1 - 0
frontend/src/models/nginx.ts

@@ -203,6 +203,7 @@ export type INginxLocation = Omit<NgxModuleData, "data"> & {
   index?: string
   root?: string
   alias?: string
+  try_files?: string
   proxy_set_header?: IProxyHeader[]
   add_header?: IProxyHeader[]
   proxy_pass?: string

+ 9 - 0
frontend/src/pages/nginx/components/cors/config.json

@@ -27,6 +27,15 @@
       "description": "配置允许跨域的请求头",
       "mode": "tags"
     },
+    {
+      "title": "公开请求头",
+      "type": "select",
+      "key": "expose",
+      "required": false,
+      "option": ["Authorization","Content-Type","Accept","Origin","Cache-Control","X-Requested-With"],
+      "description": "跨域时,允许js获取的响应头名称,当返回自定义响应头,跨域的情况下,不设置,会导致无法获取该值",
+      "mode": "tags"
+    },
     {
       "title": "拦截preflight",
       "key": "preflight",

+ 4 - 0
frontend/src/pages/nginx/components/cors/index.tsx

@@ -16,6 +16,7 @@ type DataType = {
   origins?: string[]
   methods?: string[]
   headers?: string[]
+  expose?: string[]
   preflight?: boolean
   credentials?: boolean
   maxAge?: number
@@ -87,6 +88,9 @@ export const CorsInput = ({...props}: AutoTypeInputProps)=>{
     if (!isNull(values.credentials)){
       lines.push(`add_header Access-Control-Allow-Credentials   '${values.credentials ? 'true': 'false'}';`)
     }
+    if (values.expose?.length){
+      lines.push(`add_header 'Access-Control-Expose-Headers' '${values.expose.join(',')}';`)
+    }
     if (!isNull(values.preflight)){
       lines.push(`if ($request_method = 'OPTIONS') {
         return 204;

+ 2 - 0
frontend/src/pages/nginx/components/location/utils.ts

@@ -58,6 +58,8 @@ export const renderLocation = (origin: INginxLocation) => {
     if (loc.proxy_type !== 'static'){
         delete loc.root
         delete loc.alias
+        delete loc.index
+        delete loc.try_files
     }
     if (loc.proxy_type !== 'other'){
         delete loc.return

Some files were not shown because too many files changed in this diff