DojoRequest in Web app builder

990
17
Jump to solution
12-11-2017 02:11 PM
VenkataSrikanth_Dasari
Occasional Contributor

I am requesting an image in the Dojo Request and it is appending ?wab_dv=2.6 in the url and failed to query in the custom widget..

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
VenkataSrikanth_Dasari
Occasional Contributor

CORS Issue.. Added the new URL in the proxy.config and using Proxy.ashx.

I deployed my files in the IIS and client is running web app builder using Node.js.. so unable to access the external URL.

Thanks for the help and highly appreciated.

Cheers,

Srikanth Dasari

View solution in original post

17 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Srikanth,

   What does your esriRequest url look like Extactly?

The WAB env.js has some tests it does on url to determine if it appends the WAB version to the url.

Here are the conditions that it will not append the deploy version to:

  • http:// or https:// at the beginning of the url
  • /proxy.js at the beginning of the url
  • // at the beginning of the url
0 Kudos
VenkataSrikanth_Dasari
Occasional Contributor

Thank you. 

I kept one more condition in env.js file to access shared path and as a security concern images are not keeping in the IIS.

Here is the url for the image which is not accessible in IE  ..

Url: \\NetworkDrive\TestImages\Image1.jpg

And chrome is showing the below error.

Failed to load file://sdasari-spro/TestImages/DSCN0031.JPG: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
l @ init.js:141
20:49:28.646 init.js:141 Failed to load file://sdasari-spro/TestImages: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

Please suggest me on this and would be highly appreciated.

Cheers

Srikanth Dasari

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Srikanth,

and as a security concern images are not keeping in the IIS

Can you elaborate on security concern. There is no security concern when having images in a network shared folder that is setup as a virtual directory in IIS.

If you were using a virtual directory in IIS then you would not have this issue at all. You can also add a check to the env.js appendDeployVersion function as Jushan is talking about.

for example:

if(/^http(s)?:\/\//.test(url) || /^\/proxy\.js/.test(url) || /^\/\//.test(url) || /^\\\\/.test(url)){

But I really wish there was just a way to turn this feature off as I have had to modify this function before myself to look for query in the url:

if(/^http(s)?:\/\//.test(url) || /^\/proxy\.js/.test(url) || /^\/\//.test(url) || /\/query$/.test(url)){

Which I don't think is good practice for a widget developer to have to tell their users they have to modify a core WAB file just to use their widget.

junshan_liu-esristaff

0 Kudos
VenkataSrikanth_Dasari
Occasional Contributor

Hi Robert,

Thanks for the help and I suggested virtual directory in the IIS. Now the PROBLEM is client is running web app builder using apache and we deployed/created the virtual directory in IIS.

Then I am getting the error while accessing the image is

1. OPTIONS https://hoeapp133/PhotosphereImages/images/ 404 (Not Found)

2. Response for preflight has invalid HTTP status code 404

Modification not required in env.js with the deployment in the virtual directory.

Thanks & Regards,

Srikanth Dasari

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Srikanth,

  Are you specifying a specific image in the url?

0 Kudos
VenkataSrikanth_Dasari
Occasional Contributor

Image and as well as the folder...

http://servername/VirtualDirectory/images

http://servername/VirtualDirectory/

Cheers,

Srikanth Dasari

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Srikanth,

  OK, both of those urls are directory urls and unless you have set the Virtual Directory to allow directory browsing and you add code to deal with the return of that then you are not going to get anywhere.

0 Kudos
VenkataSrikanth_Dasari
Occasional Contributor

CORS Issue.. Added the new URL in the proxy.config and using Proxy.ashx.

I deployed my files in the IIS and client is running web app builder using Node.js.. so unable to access the external URL.

Thanks for the help and highly appreciated.

Cheers,

Srikanth Dasari

VenkataSrikanth_Dasari
Occasional Contributor

Robert,  

Life is revolving around the ESRI issues...

For resolving the CORS Issue, I tried with Proxy.ashx file and unfortunately client is using Proxy.js file.. then i configure the url's in the authorizedCrossOriginDomains in the config.json.... including port number 

See the below example process flow and sample URL's

http://server1:3344/webappbuilder/apps/3  -----> trying to access the files residing in IIS  -------->    Virtual Directory which is http://server1//VD/Images

1. Enabled Directory browsing

2. Added Access-Control-Allow-Origin, Access-Control-Allow-Headers for the VD in IIS.

3. authorizedCrossOriginDomains:['server1:3344','server1:443']

Am i missing anything else....

Cheers,

Srikanth Dasari

0 Kudos