Bloody lesson-Package Vue projects into app cross-domain issues

Source: Internet
Author: User
Tags nginx server

1 devserver: {2Host: ' 192.168.1.58 ',3port:9999,4Historyapifallback:true,5Noinfo:true,6Overlaytrue,7     //Configuring the service agent8     9 Proxy: {Ten'/hydro/': {//as long as the request to/hydro/, will automatically proxy to the address of the following target OneTarget: "http://192.168.1.180:8081",//Offset server address A             //pathrewrite: { -             //' ^/hydrowebapp ': '/' -             // }, theSecurefalse, -Changeorigin:true -       }, -     } +      -},

Cross-domain issues, Webpack configured proxy servers, but only valid in the development environment, NPM run build is packaged and then invalidated.

WebApp placed in the Nginx server, Nginx agent, you can solve the cross-domain problem

WebApp to transform the mobile app, using pure HTML, using Hbuilder for the real-machine test after packaging,

Initially tested with Google Chrome,

Page report Access-control-allow-origin cross-domain errors, so start a variety of cross-domain solutions,

Finally found that the app does not exist across domains one says!

Testing in the browser, $http to request cross-domain errors, but the app packaged on the real machine running, is not a problem ...

Bloody lesson ah, hard to toss for a long time, and then found that the real machine does not exist this problem, really ... There's nothing to say!

Record their own painful experience, a total of mutual encouragement! Thank you!

=================================================

Machine debugging, the browser can not cross the domain, the phone is normal cross-domain, the console to the phone can see the results of cross-domain normally

This error is reported in the "side by side view Console" display.

If it doesn't work, re-connect your phone and restart the dock app to try it out.

Bloody lesson-Package Vue projects into app cross-domain issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.