I tried to use custom paths but get an error when doing search.

In /admin/structure/block/manage/customsearchform, on "Custom Search Paths", I set the following paths :

Paths:
http://www.google.com/q?=[key]|google
http://www.bing.com/q?=[key]|bing

When the user is validating the search form, he get the following error :

"Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it."

I am using Drupal 8.1.10 and custom_search 8.x-1.0-beta3

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

blink38 created an issue. See original summary.

blink38’s picture

I found a solution and made a patch

This first response explain how to use TrustedRedirectResponse in form response :

http://drupal.stackexchange.com/questions/136641/how-do-i-redirect-to-an...

I changed in CustomSearchBlockForm.php the response of submitForm() so that when url is external, the response use TrustedRedirectResponse.

  • jdanthinne committed 9b63c93 on 8.x-1.x
    [#2807307] by blink38: Use TrustedRedirectResponse in form response
    
jdanthinne’s picture

Status: Active » Fixed

Thanks. Pushed to dev.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.