skydive cross-domain problem solving

1. Relevant modification of front-end code

1.index.html

Delete the following code (this part is go related code, not needed).

<!-- extra assets -->
  << range $i, $asset := .ExtraAssets >>
    << if eq $asset.Ext ".css" >>
  <link rel="stylesheet" href="<< $asset.Filename >>" />
    << end >>
    << if eq $asset.Ext ".js" >>
  <script src="<< $asset.Filename >>"></script>
    << end >>
  << end >>

Add the following code:

....
<script src="/statics/js/vendor/vuejs-datepicker.js"></script>

  <script type="text/javascript">
    var HOST = 'http://192.168.32.72:8082',
        WS_HOST = '192.168.32.72:8082';
  </script>

  <script src="/statics/js/utils.js"></script>
......

2. api.js modification

Line 11, modified to:
xhr.open('POST', HOST + '/api/topology', true);
Line 67, modified to:
url: HOST + '/api/topology',
Line 87, modified to:
url: HOST + '/api/capture',
Line 104, modified to:
url: HOST + '/api/capture/' + id,
Line 119, modified to:
url: HOST + '/api/capture',
Line 149, modified to:
url: HOST + '/api/capture/' + uuid + '/',
Line 161, modified to:
url: HOST + "/api/config/" + key,
Line 171, modified to:
url: HOST + '/api/injectpacket',
Line 185, modified to:
url: HOST + '/api/injectpacket/' + uuid + '/',
Line 223, modified to:
url: HOST + '/api',

3. websocket.js modification

Change line 2 to:
this.host = WS_HOST;

4. Modify inject-form.js

Line 247, modified to:
url: HOST + '/api/injectpacket',

5. login.js modification

Line 25, modified to:
url: HOST + '/login',

Second, the back-end code modification

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325279223&siteId=291194637