Home > front end >  Cross-domain whole crazy company trainee, please help
Cross-domain whole crazy company trainee, please help

Time:09-15

In the company, the image server needed to upload the picture, but be cross-domain whole for a long time did not know how to solve, online search is done with the Vue development solution, our company use..net MVC development, in the page reference element - the UI, so couldn't according to the methods to solve the


Error reason

Checked twice as saying is set up to allow cross-domain, asked the back-end technology, there has been cancelled in Nginx allowed to cross domain, and then in the.net in the Core set up to allow cross-domain

But still have been on the surface of the former mistake, whether it's comments after the cross-domain code open nginx allow cross-domain, still can't upload, so can only help the bosses here!

CodePudding user response:

Allow cross-domain set *

CodePudding user response:

reference 1st floor jio can reply:
allow cross-domain set *
is the builder in the back-end AllowAnyOrigin (*)?

CodePudding user response:

Baidu the.net configuration cross-domain, configuration XML has written directly on the interface, depending on the project of how to use this

CodePudding user response:

reference jio can reply: 3/f
baidu..net configuration cross-domain configuration XML and write directly in the interface, this depends on how to use the

Now use a plugin to upload pictures to upload pictures, but not to cross domain can upload, particularly strange,,,

CodePudding user response:


In.net configuration file and I also added a allow cross-domain request

CodePudding user response:

Now if there is no uploadify this plug-in or cross domain

CodePudding user response:

This should be for uploading your address return messages, as long as the upload address cross-domain open, nginx is cancelled, can be directly to the page head to join [Access - Control - Allow - Origin *], all kinds of language may be little different,

CodePudding user response:

refer to 7th floor chinaskysun response:
this should be you want to Access to upload the address returned by the news, as long as the upload address cross-domain open, nginx is cancelled, can be directly to the page head to join [Access - Control - Allow - Origin *], all kinds of language may be slightly different,

But seems to be opened, set up a multiple error information is said to allow the value of the cross-domain but I look at the backend code, clearly set up only once, and delete the code to cross domain, and I had nginx increase allow cross-domain or cross domain

CodePudding user response:

It can check nginx cross-domain files inside if there are any problems

CodePudding user response:

Before I has also had the ajax call API, you look at your data is json type
The data: the form, change to JSON. Stringify (form) try

CodePudding user response:

11 references 姎 jacaranda response:
I has also had the ajax call API, before you look at your data if the json type
The data: the form, change to JSON. Stringify (form) try

But picture is sent, picture json format can be changed?

CodePudding user response:

11 references 姎 jacaranda response:
I has also had the ajax call API, before you look at your data if the json type
The data: the form, change to JSON. Stringify (form) try

I use axios request also is same,,,

CodePudding user response:

11 references 姎 jacaranda response:
I has also had the ajax call API, before you look at your data if the json type
The data: the form, change to JSON. Stringify (form) try


CodePudding user response:

I'm in JAVA, cross domain is resolved in the background, I think the.net should also can like

 

//cross domain
HttpPost. SetHeader (" Access - Control - Allow - Origin ", "*");
//cross-domain Header
HttpPost. SetHeader (" Access - Control - Allow - the Methods ", "*");
HttpPost. SetHeader (" Access - Control - Allow - Headers ", "the content-type, apikey");//configuration you here to define the parameter
//set the header information
HttpPost. SetHeader (" the content-type ", "application/json");
HttpPost. SetHeader (" apikey ", apikey);
HttpPost. SetHeader (" the user-agent ", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT. DigExt) ");



Part of the code

CodePudding user response:

Before I had a similar problem of cross-domain
The debugger you'll find you here @ imgroot=underfind if if is and I have the same problem


Personal speculation is caused by the interaction between different source files cross-domain problem or with a specific source files in the directory cross-domain problem caused by the interaction in


Under the specific solutions you search again


CodePudding user response:

I before because some reference of project

Then new developed some functions, and interface of what is in front of, js file under the

Then points in different directory

I put the interface position in a file
  • Related