File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,18 @@ public static function getHandler($handler): string
51
51
));
52
52
}
53
53
54
+ // When the application is running behind a proxy and the TrustedProxy middleware has not been set up yet,
55
+ // an error like [HttpRequest.url must start with 'https'] could be thrown. Since the handler URL must
56
+ // always be https, we will provide a little extra information on how to fix this.
57
+ if ($ parse ['scheme ' ] !== 'https ' ) {
58
+ throw new Exception (sprintf (
59
+ 'Unable to push task to Cloud Tasks because the hander URL is not https. Google Cloud Tasks ' .
60
+ 'will only call safe (https) URLs. If you are running Laravel behind a proxy (e.g. Ngrok, Expose), make sure it is ' .
61
+ 'as a trusted proxy. To quickly fix this, add the following to the [app/Http/Middleware/TrustProxies] middleware: ' .
62
+ 'protected $proxies = \'* \'; '
63
+ ));
64
+ }
65
+
54
66
// Versions 1.x and 2.x required the full path (e.g. my-app.com/handle-task). In 3.x and beyond
55
67
// it is no longer necessary to also include the path and simply setting the handler
56
68
// URL is enough. If someone upgrades and forgets we will warn them here.
You can’t perform that action at this time.
0 commit comments