Commit Graph

27 Commits

Author SHA1 Message Date
MichaIng
50686f9e26 Append http:// if scheme is missing when dumping mirrors (#16)
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>
2021-08-03 17:15:29 -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
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
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
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
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
Lane Jennison
320f8ec9db region tweaks 2020-11-29 19:54:25 -05:00
Lane Jennison
32629a61ed woohoo it works 2020-11-29 19:35:21 -05:00
Lane Jennison
3f5d75e43e uwsgi safe reload adn yaml based config.. wip region 2020-11-29 13:53:27 -05:00
Lane Jennison
7a2c61ef5c readline fix 2020-07-30 08:35:36 -04:00
Lane Jennison
bcea6c80d8 dl reads from mirrors.conf 2020-07-30 08:20:23 -04:00
Lane Jennison
f74d40d63b and tuna mirror 2020-07-27 08:25:09 -04:00
Lane Jennison
ae0e4eb58f mirror provides trailing / 2020-07-27 07:54:04 -04:00
Lane Jennison
32a34c4f90 remove leading / from key 2020-07-27 07:45:43 -04:00
Lane Jennison
4d30e7df7d get ip function 2020-07-26 19:07:40 -04:00
Lane Jennison
c805d3bfef support new userdata.csv format 2020-07-26 10:09:01 -04:00