4

I got the esri js api 3.14 deployed on a server and an application that is reachable over https.

Now I got a proxy script that delivers the map requests.

When you look at the requests of the page you can see that there is ONE request (an info request to the rest interace) that goes directly to the internalServer.

The Chrome Browser says: enter image description here

Firefox says:

enter image description here

I added the proxy script rule like this:

urlUtils.addProxyRule({
                urlPrefix: "http://srvutdemo102/arcgis/rest/services/utjsc_de/Grundkarte",
                proxyUrl: "ESRI_proxy.jsp"
            });

Is it possible to tell the js-api to use the proxy script for this "initial" info request?

1

2 Answers 2

1

If you need to share your services in applications that utilize HTTPS, then you are far better off configuring ArcGIS Server to support it than relying on a proxy to attempt to 'fake it'.

http://blogs.esri.com/esri/arcgis/2015/03/11/sharing-web-gis-services-always-enable-tls/

that being said, the info request is a check for CORS support, so if you know that the server already supports CORS (or that you won't need it to), you can skip sending the request by calling

esriConfig.defaults.io.corsEnabledServers.push("[server.domain]");

example here.

5
  • He's not trying to 'fake' HTTPS, he's trying to get the API to use his proxy for that URL. It's an internal server anyway (the server srvutdemo102 isn't accessible from the interweb) so he has to do something along those lines.
    – Juffy
    Commented Nov 26, 2015 at 1:08
  • he is 100% faking https. this is why his browser is complaining about mixed content. seperately, you are correct that his technique is exposing a server thats otherwise inaccessible. Commented Nov 26, 2015 at 1:13
  • If the proxy call worked (which is his actual question) it would be calling it over HTTPS, because the proxy's on the same server. Therefore there's no 'faking' HTTPS or CORS issues.
    – Juffy
    Commented Nov 26, 2015 at 1:22
  • This is a real life scenario. The application "runs" in a DMZ and the ArcGIS Server and the Databases are in the LAN. The ArcGIS Server will never be reachable directly from www. Btw it´s way to expensive to place a second ArcGIS Server in the DMZ :)
    – Matthias
    Commented Nov 26, 2015 at 7:39
  • Johns answer ist correct ! I set esriConfig.defaults.io.corsDetection=false; to disable the whole thing
    – Matthias
    Commented Nov 26, 2015 at 8:00
0

Your proxy rule specifies the URL prefix

http://srvutdemo102/arcgis/rest/services/utjsc_de/Grundkarte

but in my Chrome dev tools Network tab the first request is to

http://srvutdemo102/arcgis/rest/info?f=json

...which doesn't match the prefix. If you modify your proxy role URL to http://srvutdemo102/arcgis/rest I think you will have a lot more success.

3
  • Sorry to say: Its the same... I updated the example page.
    – Matthias
    Commented Nov 26, 2015 at 7:46
  • I think @JohnGravois and I are both correct, just coming from different angles. With the above changes to the proxy rule I can see lots of calls to https://demo.baral.de/EsriProxyTest/ESRI_proxy.jsp?http://srvutdemo102/arcgis/rest/services/utjsc_de/Grundkarte/MapServer/tile/4/76472/81098, which is the proxy page functioning correctly.
    – Juffy
    Commented Nov 26, 2015 at 8:24
  • However the direct call to http://srvutdemo102/arcgis/rest/info?f=json is made (and throws the error in Chrome) regardless of proxy settings unless you turn CORS detection off. Of course even if Chrome didn't block it, the call would fail because it's not in your DMZ....
    – Juffy
    Commented Nov 26, 2015 at 8:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.