secondlife / jira-archive

3 stars 0 forks source link

[BUG-226530] Fix CORS settings for map tile server #5048

Open sl-service-account opened 5 years ago

sl-service-account commented 5 years ago

How would you like the feature to work?

Allow 3D map viewers in browsers to access the Second Life map tiles without CORS errors.

Map tiles can be accessed most efficiently at

https://secondlife-maps-cdn.akamaized.net

but that SL domain at Akamai was configured with cross-origin requests disabled. This is the default, to protect the confidentiality of the content. But LL doesn't consider the SL map to be confidential; instructions on how to get the raw images are at

http://wiki.secondlife.com/wiki/Linden_Lab_Official:Map_API_Introduction

Browsers can already access an image across origins and display it to the user, as the current Leaflet-based map viewer does. But programmed access to an image in a browser is not allowed unless the site allows it by providing the appropriate CORS header. This is to prevent ad code from getting access to images of bank statements and such.

WebGL is considered "programmed access". So 3D map viewers won't work.

For background, see

https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Using_textures_in_WebGL

To configure Akamai, see:

https://learn.akamai.com/en-us/webhelp/akamai-api-gateway/akamai-api-gateway-user-guide/GUID-A2069ECB-C88F-4B98-9468-E48AEC1F0800.html

Please set "Enable CORS" to Yes, and "Allowed Origins" to "*". Thanks.

(There's a way to work around this with a CORS proxy server, but it's a big load on the proxy server. Front-ending Akamai with your own server is silly, inefficient, and expensive, but possible. It's also possible to put a plug-in into Firefox which bypasses CORS for specified sites, which is how I debug the 3D map viewer. But asking users to do that is not a good idea.)

Why is this feature important to you? How would it benefit the community?

See the attached picture. I want to make maps like that easily available. I put a few images on the forums, and they were very popular. It gives a real sense of the scale of SL.

https://community.secondlife.com/forums/topic/434213-above-second-life/?tab=comments#comment-1869619

It also runs faster and more smoothly than the SL map viewer. All SL users have OpenGL capable computers, so doing this through OpenGL hardware works better than doing it the way Leaflet does it.

Source code is at: https://github.com/John-Nagle/secondlife-mapping

Attachments

Links

Related

Original Jira Fields | Field | Value | | ------------- | ------------- | | Issue | BUG-226530 | | Summary | Fix CORS settings for map tile server | | Type | New Feature Request | | Priority | Unset | | Status | Accepted | | Resolution | Accepted | | Reporter | animats (animats) | | Created at | 2019-03-14T20:16:41Z | | Updated at | 2023-09-12T19:13:28Z | ``` { 'Build Id': 'unset', 'Business Unit': ['Platform'], 'How would you like the feature to work?': 'Allow 3D map viewers in browsers to access the Second Life map tiles without CORS errors.\r\n\r\nMap tiles can be accessed most efficiently at\r\n\r\nhttps://secondlife-maps-cdn.akamaized.net\r\n\r\nbut that SL domain at Akamai was configured with cross-origin requests disabled. This is the default, to protect the confidentiality of the content. But LL doesn\'t consider the SL map to be confidential; instructions on how to get the raw images are at \r\n\r\nhttp://wiki.secondlife.com/wiki/Linden_Lab_Official:Map_API_Introduction\r\n\r\nBrowsers can already access an image across origins and display it to the user, as the current Leaflet-based map viewer does. But programmed access to an image in a browser is not allowed unless the site allows it by providing the appropriate CORS header. This is to prevent ad code from getting access to images of bank statements and such.\r\n\r\nWebGL is considered "programmed access". So 3D map viewers won\'t work.\r\n\r\nFor background, see\r\n\r\nhttps://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Using_textures_in_WebGL\r\n\r\nTo configure Akamai, see:\r\n\r\nhttps://learn.akamai.com/en-us/webhelp/akamai-api-gateway/akamai-api-gateway-user-guide/GUID-A2069ECB-C88F-4B98-9468-E48AEC1F0800.html\r\n\r\nPlease set "Enable CORS" to Yes, and "Allowed Origins" to "*". Thanks.\r\n\r\n(There\'s a way to work around this with a CORS proxy server, but it\'s a big load on the proxy server. Front-ending Akamai with your own server is silly, inefficient, and expensive, but possible. It\'s also possible to put a plug-in into Firefox which bypasses CORS for specified sites, which is how I debug the 3D map viewer. But asking users to do that is not a good idea.)\r\n\r\n', 'Original Reporter': 'animats (animats)', 'ReOpened Count': 0.0, 'Severity': 'Unset', 'Target Viewer Version': 'viewer-development', 'Why is this feature important to you? How would it benefit the community?': 'See the attached picture. I want to make maps like that easily available. I put a few images on the forums, and they were very popular. It gives a real sense of the scale of SL.\r\n\r\nhttps://community.secondlife.com/forums/topic/434213-above-second-life/?tab=comments#comment-1869619\r\n\r\nIt also runs faster and more smoothly than the SL map viewer. All SL users have OpenGL capable computers, so doing this through OpenGL hardware works better than doing it the way Leaflet does it.\r\n\r\nSource code is at: https://github.com/John-Nagle/secondlife-mapping', } ```
sl-service-account commented 5 years ago

animats commented at 2019-03-16T00:47:17Z

Here's what it looks like to really use this capability. "Above Second Life", the video.

https://vimeo.com/324379408

If CORS is enabled as above, I'll make the 3D viewer used for making that video available.

 

sl-service-account commented 1 year ago

animats commented at 2023-02-03T17:38:48Z, updated at 2023-02-03T17:39:47Z

Four years later...

I've revived my live slippy map of Second Life. It's at http://animats.com/sl/map/.

But it uses a free third-party service to front-end the SL map tile server and bypass this CORS bug. Such services tend to come and go. So this feature may disappear at any time. If LL fixes this bug, I'll make a stable version of the slippy map. Right now, I can't do that.

 

sl-service-account commented 1 year ago

animats commented at 2023-09-12T19:13:29Z

My slippy map is down again. I have to keep putting some free proxy server in front of Akamai to work around this, and after a while they get tired of serving SL map tiles for free. I've been through three free CORS proxy servers now. Could we get this setting changed, please? Thanks.

Instructions on how to fix this at Akamai: https://techdocs.akamai.com/api-definitions/docs/cross-origin-resource-sharing-cors