vue.js - tetapan proksi apache vue
淡淡烟草味
淡淡烟草味 2017-05-16 16:57:16
0
3
526

Saya ingin mengakses http://localhost:8080/xxxx tempatan dan arahkan ke http://xingke.iask.in/xxx supaya tiada masalah merentas domain.
Tetapi apabila saya menyediakan proksi apache, saya tidak menyediakannya dengan betul. Akses masih menghala ke
apache vohosts

tempatan
<VirtualHost *:80>
    ServerAdmin wx@qq.com
    DocumentRoot "D:/Develop/WWW/Online/Hphp/Public"
    ServerName xingke.iask.in
    ServerAlias xingke.iask.in
    #代理
    ProxyPass / http://xingke.iask.in/ 
    ProxyPassReverse / http://xingke.iask.in 
    <proxy http://xingke.iask.in> 
        AllowOverride None 
        Order Deny,Allow 
        Allow from all 
    </proxy> 

    ErrorLog "logs/dummy-host2.xingke.iask.in-error.log"
    CustomLog "logs/dummy-host2.xingke.iask.in-access.log" common
</VirtualHost>

Alamat permintaan setempat: http://xingke.iask.in/home/in...
Kemudian ralat berikut dilaporkan

Ralat 500 dilaporkan di sini, dan perkhidmatan itu tidak boleh diakses Bagaimana saya perlu menyediakannya? ! !

淡淡烟草味
淡淡烟草味

membalas semua(3)
为情所困

Bukankah permintaan tempatan sepatutnya menjadi hos tempatan? Adakah proksi Apache mengembalikan lompatan 30x Jika ya, hasilnya masih merupakan permintaan merentas domain Jika nginx digunakan untuk menetapkan proksi, lompatan 30x tidak akan dikembalikan.

Adalah disyorkan untuk mempertimbangkan menggunakan nginx untuk menyediakan proksi Sila rujuk:

https://zhuanlan.zhihu.com/p/...

漂亮男人

Untuk rujukan anda, berikut ialah proksi yang sesuai yang saya bangunkan dalam dev, berdasarkan vue-cli, index.js dalam direktori konfigurasi

// see http://vuejs-templates.github.io/webpack for documentation.
var path = require('path')

module.exports = {
  build: {
    env: require('./prod.env'),
    index: path.resolve(__dirname, '../dist/index.html'),
    assetsRoot: path.resolve(__dirname, '../dist'),
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    productionSourceMap: true,
    // Gzip off by default as many popular static hosts such as
    // Surge or Netlify already gzip all static assets for you.
    // Before setting to `true`, make sure to:
    // npm install --save-dev compression-webpack-plugin
    productionGzip: false,
    productionGzipExtensions: ['js', 'css']
  },
  dev: {
    env: require('./dev.env'),
    port: 8080,
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    proxyTable: {
      //login-controller begin
      '/OSSCallbackServer': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/forbidden': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/getPolicy': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/login': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/logout': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/user/read/current': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/regin': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/unauthorized': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },

      //scheduled-controller
      '/scheduled/close/task': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/scheduled/del/task': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/scheduled/open/task': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/scheduled/read/log': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/scheduled/read/tasks': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/scheduled/run/task': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/scheduled/update/task': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },

      //权限管理接口
      '/cache/update': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/role/update/menu': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/user/update/menu': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/user/update/role': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },


      //部门管理接口
      '/dept/add': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/dept/delete': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/dept/read/detail': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/dept/read/list': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/dept/update': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },

      //字典管理
      '/dic/add': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/dic/delete': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/dic/read/detail': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/dic/read/key': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/dic/read/list': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/dic/update': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/dicIndex/add': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/dicIndex/delete': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/dicIndex/read/detail': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/dicIndex/read/list': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/dicIndex/update': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },

      //菜单管理
      '/menu/add': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/menu/delete': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/menu/read/detail': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/menu/read/list': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/menu/read/permission': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/menu/update': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },

      //系统参数管理
      '/param/add': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/param/delete': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/param/read/detail': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/param/read/list': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/param/update': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },

      //角色管理
      '/role/add': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/role/delete': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/role/read/detail': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/role/read/list': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/role/read/permission': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/role/update': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },

      //会话管理
      '/session/delete': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/session/read/list': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },

      //用户管理
      '/user/read/current': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/user/read/detail': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/user/read/list': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/user/update': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/user/update/password': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },

      //第三方登录接口
      '/callback/qq': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/callback/sina': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/callback/wx': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/sns': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/sns_bind': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/sns_fail': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/sns_success': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },

      //文件上传接口
      '/upload/image': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      },
      '/upload/imageData': {
        target: 'http://172.16.0.98:8087',
        changeOrigin: true
      }



    },
    // CSS Sourcemaps off by default because relative paths are "buggy"
    // with this option, according to the CSS-Loader README
    // (https://github.com/webpack/css-loader#sourcemaps)
    // In our experience, they generally work as expected,
    // just be aware of this issue when enabling this option.
    cssSourceMap: false
  }
}
小葫芦

cors merentas domain, dengan cara ini, anda perlu mengkonfigurasi p3p untuk membuat IE menyokong kuki merentas domain

Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan
Tentang kita Penafian Sitemap
Laman web PHP Cina:Latihan PHP dalam talian kebajikan awam,Bantu pelajar PHP berkembang dengan cepat!