Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Библиотеку нельзя использовать под https #9

Open
lav-coder opened this issue Feb 16, 2018 · 2 comments

Comments

@lav-coder
Copy link

Библиотеку нельзя использовать на сайте с "https".
Пожалуйста, сделайте такую возможность!

Под капотом библиотеки выполняется запрос:
http://data.esosedi.org/geocode/v1?point=57.153033,65.534328&lng=ru
А вот такое не пашет:
https://data.esosedi.org/geocode/v1?point=57.153033,65.534328&lng=ru
Отсюда получаем проблемы... И классическую ошибку браузера:

Mixed Content: бла-бла-бла was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://data.esosedi.org/geocode/v1?point=57.153033,65.534328&lng=ru'. This request has been blocked; the content must be served over HTTPS.

@theKashey
Copy link
Contributor

Можно, целых два варианта есть

  1. пакет https://github.com/esosedi/osme-geometry, хоть локально данные подключай, хоть через unpkg (только вот сам пакет мегов 300 весит, но каждый импорт очень маленький)
  2. osmeRegions.setHost('https://osme.geolocated.org/regions/v1/'); <-- это просто прокси через cloudflare

@lav-coder
Copy link
Author

lav-coder commented Feb 16, 2018

Проблему решил...
Там в коде библиотеки есть небольшая неправильность... Должно быть написано так:

var settings = {
HOST: window.location.protocol === 'https:' ? 'https://osme.geolocated.org/regions/v1/' : 'http://data.esosedi.org/regions/v1/',
GEOCODEHOST: window.location.protocol === 'https:' ? 'https://osme.geolocated.org/geocode/v1' : 'http://data.esosedi.org/geocode/v1',

И еще, там есть метод setHost(), а вот метод setGeocodeHost() отсутствует, если уж совсем придираться...
Спасибо за оперативный ответ!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants