Browse Source

bugfix: 修复跨域配置的问题

tuonian 1 year ago
parent
commit
4b2049f39c
2 changed files with 8 additions and 8 deletions
  1. 7 7
      src/config/nginx_form.json
  2. 1 1
      src/pages/nginx/components/cors/index.tsx

+ 7 - 7
src/config/nginx_form.json

@@ -141,6 +141,13 @@
         }
       ]
     },
+    {
+      "key": "cors_setting",
+      "title": "跨域配置",
+      "type": "cors",
+      "description": "跨域配置,可以通过该配置项解决前端跨域问题",
+      "required": false
+    },
     {
       "key": "tmp_custom_config",
       "title": "自定义配置",
@@ -177,13 +184,6 @@
           "required": false,
           "value": "10m"
         },
-        {
-          "key": "access_log",
-          "type": "string",
-          "placeholder": "access日志文件路径",
-          "required": false,
-          "title": "Access日志"
-        },
         {
           "key": "charset",
           "title": "编码",

+ 1 - 1
src/pages/nginx/components/cors/index.tsx

@@ -79,7 +79,7 @@ export const CorsInput = ({...props}: AutoTypeInputProps)=>{
     }
 
     if (values.methods?.length){
-      lines.push(`add_header 'Access-Control-Allow-Origin' '${values.methods.join(',')}';`)
+      lines.push(`add_header 'Access-Control-Allow-Methods' '${values.methods.join(',')}';`)
     }
     if (values.headers?.length){
       lines.push(`add_header 'Access-Control-Allow-Headers' '${values.headers.join(',')}';`)