Changed validate_url to have default value of false

This commit is contained in:
Alejandro Celaya
2019-12-31 16:29:32 +01:00
parent 339121fbb1
commit 0cf1d8d375
5 changed files with 8 additions and 7 deletions

View File

@@ -9,7 +9,7 @@ return [
'schema' => 'https', 'schema' => 'https',
'hostname' => '', 'hostname' => '',
], ],
'validate_url' => true, 'validate_url' => false,
'visits_webhooks' => [], 'visits_webhooks' => [],
], ],

View File

@@ -61,6 +61,7 @@ return [
'schema' => 'http', 'schema' => 'http',
'hostname' => 'doma.in', 'hostname' => 'doma.in',
], ],
'validate_url' => true,
], ],
'zend-expressive-swoole' => [ 'zend-expressive-swoole' => [

View File

@@ -103,7 +103,7 @@ This is the complete list of supported env vars:
* **postgres** -> `5432` * **postgres** -> `5432`
* `DISABLE_TRACK_PARAM`: The name of a query param that can be used to visit short URLs avoiding the visit to be tracked. This feature won't be available if not value is provided. * `DISABLE_TRACK_PARAM`: The name of a query param that can be used to visit short URLs avoiding the visit to be tracked. This feature won't be available if not value is provided.
* `DELETE_SHORT_URL_THRESHOLD`: The amount of visits on short URLs which will not allow them to be deleted. Defaults to `15`. * `DELETE_SHORT_URL_THRESHOLD`: The amount of visits on short URLs which will not allow them to be deleted. Defaults to `15`.
* `VALIDATE_URLS`: Boolean which tells if shlink should validate a status 20x (after following redirects) is returned when trying to shorten a URL. Defaults to `true`. * `VALIDATE_URLS`: Boolean which tells if shlink should validate a status 20x is returned (after following redirects) when trying to shorten a URL. Defaults to `false`.
* `INVALID_SHORT_URL_REDIRECT_TO`: If a URL is provided here, when a user tries to access an invalid short URL, he/she will be redirected to this value. If this env var is not provided, the user will see a generic `404 - not found` page. * `INVALID_SHORT_URL_REDIRECT_TO`: If a URL is provided here, when a user tries to access an invalid short URL, he/she will be redirected to this value. If this env var is not provided, the user will see a generic `404 - not found` page.
* `REGULAR_404_REDIRECT_TO`: If a URL is provided here, when a user tries to access a URL not matching any one supported by the router, he/she will be redirected to this value. If this env var is not provided, the user will see a generic `404 - not found` page. * `REGULAR_404_REDIRECT_TO`: If a URL is provided here, when a user tries to access a URL not matching any one supported by the router, he/she will be redirected to this value. If this env var is not provided, the user will see a generic `404 - not found` page.
* `BASE_URL_REDIRECT_TO`: If a URL is provided here, when a user tries to access Shlink's base URL, he/she will be redirected to this value. If this env var is not provided, the user will see a generic `404 - not found` page. * `BASE_URL_REDIRECT_TO`: If a URL is provided here, when a user tries to access Shlink's base URL, he/she will be redirected to this value. If this env var is not provided, the user will see a generic `404 - not found` page.
@@ -137,7 +137,7 @@ docker run \
-e DB_PORT=3306 \ -e DB_PORT=3306 \
-e DISABLE_TRACK_PARAM="no-track" \ -e DISABLE_TRACK_PARAM="no-track" \
-e DELETE_SHORT_URL_THRESHOLD=30 \ -e DELETE_SHORT_URL_THRESHOLD=30 \
-e VALIDATE_URLS=false \ -e VALIDATE_URLS=true \
-e "INVALID_SHORT_URL_REDIRECT_TO=https://my-landing-page.com" \ -e "INVALID_SHORT_URL_REDIRECT_TO=https://my-landing-page.com" \
-e "REGULAR_404_REDIRECT_TO=https://my-landing-page.com" \ -e "REGULAR_404_REDIRECT_TO=https://my-landing-page.com" \
-e "BASE_URL_REDIRECT_TO=https://my-landing-page.com" \ -e "BASE_URL_REDIRECT_TO=https://my-landing-page.com" \
@@ -163,7 +163,7 @@ The whole configuration should have this format, but it can be split into multip
"delete_short_url_threshold": 30, "delete_short_url_threshold": 30,
"short_domain_schema": "https", "short_domain_schema": "https",
"short_domain_host": "doma.in", "short_domain_host": "doma.in",
"validate_url": false, "validate_url": true,
"invalid_short_url_redirect_to": "https://my-landing-page.com", "invalid_short_url_redirect_to": "https://my-landing-page.com",
"regular_404_redirect_to": "https://my-landing-page.com", "regular_404_redirect_to": "https://my-landing-page.com",
"base_url_redirect_to": "https://my-landing-page.com", "base_url_redirect_to": "https://my-landing-page.com",

View File

@@ -86,7 +86,7 @@ return [
'schema' => env('SHORT_DOMAIN_SCHEMA', 'http'), 'schema' => env('SHORT_DOMAIN_SCHEMA', 'http'),
'hostname' => env('SHORT_DOMAIN_HOST', ''), 'hostname' => env('SHORT_DOMAIN_HOST', ''),
], ],
'validate_url' => (bool) env('VALIDATE_URLS', true), 'validate_url' => (bool) env('VALIDATE_URLS', false),
'visits_webhooks' => $helper->getVisitsWebhooks(), 'visits_webhooks' => $helper->getVisitsWebhooks(),
], ],

View File

@@ -38,7 +38,7 @@ class SimplifiedConfigParserTest extends TestCase
'disable_track_param' => 'bar', 'disable_track_param' => 'bar',
'short_domain_schema' => 'https', 'short_domain_schema' => 'https',
'short_domain_host' => 'doma.in', 'short_domain_host' => 'doma.in',
'validate_url' => false, 'validate_url' => true,
'delete_short_url_threshold' => 50, 'delete_short_url_threshold' => 50,
'invalid_short_url_redirect_to' => 'foobar.com', 'invalid_short_url_redirect_to' => 'foobar.com',
'redis_servers' => [ 'redis_servers' => [
@@ -79,7 +79,7 @@ class SimplifiedConfigParserTest extends TestCase
'schema' => 'https', 'schema' => 'https',
'hostname' => 'doma.in', 'hostname' => 'doma.in',
], ],
'validate_url' => false, 'validate_url' => true,
'visits_webhooks' => [ 'visits_webhooks' => [
'http://my-api.com/api/v2.3/notify', 'http://my-api.com/api/v2.3/notify',
'https://third-party.io/foo', 'https://third-party.io/foo',