Esri/resource-proxy

Uncaught SyntaxError: Unexpected token } in JSON at position

anakaine opened this issue · 4 comments

A fresh install of PHP resource proxy with a fresh, simple ESRI-Leaflet map that works without error providing no proxy'd address is used. Once a feature service is used with the proxy the following error is returned. So far I've been unable to locate where the issue is arising from. The logical things like checking for duplicate or absent list elements, line terminations, etc, isn't giving me much joy.

The browser error in Chrome is:
Uncaught SyntaxError: Unexpected token } in JSON at position xxx
The returned line in question is: {"https://serveraddress/arcgis/rest/services/name/FeatureServer/0"}
The closing } is flagged as the source of the error.

The layer is being called via:

    // create a feature layer and add it to the map
    var pedestrianDistricts = L.esri.featureLayer({
      url: 'http://ipaddress/mapproxy/proxy.php?https://serveraddress/arcgis/rest/services/name/FeatureServer/0'
    }).addTo(map);

The proxy.config looks like:

<?xml version="1.0" encoding="utf-8" ?>
     <ProxyConfig allowedReferers="*"
			 logLevel="1"
             logFile="proxy_log.log"
             mustMatch="true">
    <serverUrls>
        <serverUrl url="http://services.arcgisonline.com"
                   matchAll="true"/>
	<serverUrl url="http://serveraddress"
                   matchAll="true"
		   username="exampleuser"
		   password="examplepassword"
		   rateLimit="120"
		   rateLimitPeriod="60"/>
    </serverUrls>
</ProxyConfig>

So far as I can tell theres no issue collecting the token. The console is free of other errors, and the log file looks like:

06-24-19 09:29:22 | GET detected
06-24-19 09:29:22 | ips table created!
06-24-19 09:29:22 | clicks table created!
06-24-19 09:29:22 | Resource using ArcGIS Server security
06-24-19 09:29:22 | Got token endpoint
06-24-19 09:29:22 | Adding token to session
06-24-19 09:29:22 | Ok to proxy
06-24-19 09:29:22 | Proxy complete
 
06-24-19 09:36:59 | GET detected
06-24-19 09:36:59 | Using session token
06-24-19 09:36:59 | Ok to proxy
06-24-19 09:36:59 | Proxy complete

The php version of the script is:
1.1.2

From php-verification.php:
Check PHP version 5.6 or newer? | Pass [v7.3.4]
Check if directory is writable? | Pass
Check for PDO Sqlite extension? | Pass
Check for Curl? | Pass [v.7.61.1]

Proxy url must be passed as a separate parameter, as the below example:

// create a feature layer and add it to the map
    var pedestrianDistricts = L.esri.featureLayer({
      proxy: 'http://ipaddress/mapproxy/proxy.php',
      url: 'https://serveraddress/arcgis/rest/services/name/FeatureServer/0'
    }).addTo(map);

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you need additional assistance please contact Esri Technical Support. Thank you for your contributions.

This issue has been automatically closed due to inactivity. If you need additional assistance please contact Esri Technical Support.