Commit Graph

46 Commits

Author SHA1 Message Date
lanefu
1a1bfc4a16 hotfix userdata path config 2021-08-28 13:31:08 -04:00
lanefu
bf8cb87d33 Append http:// if scheme is missing when dumping mirrors (#16) (#17)
as the armbian-config mirror selector currently requires this, while schemes can be missing since https://github.com/armbian/dl-router/pull/14.

Signed-off-by: MichaIng <micha@dietpi.com>

Co-authored-by: MichaIng <micha@dietpi.com>
2021-08-03 21:43:12 -04:00
MichaIng
0656d6ce04 Remove the URL schemes from mirrors (#15)
* Remove the URL schemes from mirrors

as of: https://github.com/armbian/dl-router/pull/14

Signed-off-by: MichaIng <micha@dietpi.com>

* Remove the URL schemes from mirrors

as of: https://github.com/armbian/dl-router/pull/14

But leave https://minio.k-space.ee untouched as it does a forced HTTPS redirect anyway. That way one additional redirect is prevented, if the client's original request is plain HTTP.

Signed-off-by: MichaIng <micha@dietpi.com>

* Fix syntax in scheme check

Signed-off-by: MichaIng <micha@dietpi.com>
2021-08-03 15:14:33 -04:00
MichaIng
b74ab30143 [AR-604] Preserve protocol from client request if not given in mirror list (#14)
* [AR-604] Preserve protocol from client request if not given in mirror list

Currently redirects are done based on a mirror list with hardcoded URL scheme/protocol. This causes issues when either the client does not support the target protocol (e.g. no HTTPS support) or if the client does not allow its HTTPS request to be downgraded to plain HTTP, either in general or due to respected HSTS information. The usually expected behaviour for redirects is to preserve the protocol of the client request and in case leave HTTPS upgrades to be done by the target server.

This commit aims to implement that behaviour in an optional non-breaking way:
- If the protocol is given in the mirror list, it is used like before. This allows to force a protocol by the router, in case the mirror is not assured to support what the client requests. It is better to let the client decide whether to accept the protocol change or not, instead of letting it doing a request which is doomed to fail.
- If the protocol is not given in the mirror list, it is derived from the client's request scheme. This means that the mirror list needs to be changed for this commit to have any effect.

Signed-off-by: MichaIng <micha@dietpi.com>

* [AR-604] Remove scheme from mirrors with support HTTP + HTTPS

With PR https://github.com/armbian/dl-router/pull/14 mirrors are allowed to be given without URL scheme/protocol in the list file, in which case the client's request protocol is preserved. All currently active mirrors have been tested to support both HTTP and HTTPS and having no forced HTTP => HTTPS redirect. Some mirrors respond with a HSTS header, when connecting via HTTPS, but this cannot break any client request, as obviously the client supports HTTPS when it received the HSTS header once.

The "minio.k-space.ee" mirror is the only one with a forced HTTP => HTTPS redirect, but it is currently not in use. If this mirrors gets re-enabled, to avoid doubled redirects, it makes sense to leave the scheme in place.

Signed-off-by: MichaIng <micha@dietpi.com>
2021-08-03 14:36:36 -04:00
lanefu
e1d242f2ef Merge pull request #13 from jeanrhum/master
read mirrors conf path from env variable
2021-03-17 15:47:17 -04:00
jeanrhum
26b1064f0c Update main.py
Use the environment variable ARMBIAN_MIRROR_CONF to select the mirrors used. Default is the local mirrors.yaml.
2021-03-15 16:04:59 +01:00
jeanrhum
93b110b557 Update main.py
conditionally load uwsgi modiule
2021-03-15 15:11:10 +01:00
Lane Jennison
7632a9d9f6 conditionally load uwsgi modiule 2021-03-15 09:58:36 -04:00
jeanrhum
96d55a9bdd Update main.py
Adding command line parameter to set a mirror config file: https://github.com/armbian/dl-router/issues/12
2021-03-12 18:50:43 +01:00
jeanrhum
31d30a82b3 Update mirror_list.py
Add a mirror path paramater to class Mirror
2021-03-12 18:48:51 +01:00
Lane Jennison
b4940a3da7 dont forget to close the mirror file 2021-03-10 22:19:40 -05:00
lanefu
26434398fe Code Quality Improvements by yaleman
Testing and more pythonic things
2020-12-29 19:37:53 -05:00
James Hodgkinson
283427ab43 whitespace 2020-12-29 21:49:22 +10:00
James Hodgkinson
4a503b6c72 re-introducted reloading 2020-12-29 21:48:21 +10:00
James Hodgkinson
6646589e6c more error checking, fixed a todo 2020-12-29 21:43:38 +10:00
lanefu
8a7b50fa8d Merge pull request #10 from armbian/add-geo
Add support for automatic geo based redirection
2020-12-19 23:09:45 -05:00
Lane Jennison
792cc3750b geoip info in readme 2020-12-19 23:04:45 -05:00
Lane Jennison
121b5f2b1f return none object instead of string 2020-12-19 22:38:38 -05:00
Lane Jennison
4ec33acd91 add geoip endpoint 2020-12-19 22:27:33 -05:00
Lane Jennison
1704f6c8b2 add dependencies to requirements, error handling and debug code 2020-12-17 23:45:24 -05:00
Igor Pecovnik
b1f234dbe8 Add support for automatic geo based redirection 2020-12-17 18:33:34 +01:00
lanefu
a2b02ae7e6 Update README.md 2020-11-29 21:29:08 -05:00
lanefu
ed1ca49d2b Update README.md 2020-11-29 21:28:13 -05:00
Lane Jennison
3de0f309eb correct systemd examples 2020-11-29 21:09:12 -05:00
lanefu
8acb3c99e7 Merge pull request #8 from armbian/yaml-config
flattened code base
uses yaml config for mirrors
user can manually choose region via path /region/2LETTEREGIONCODE/rest/of/path
added examples
updated readme
2020-11-29 20:27:09 -05:00