Href prefix not applied to search results page

Hello,

I’ve installed a reverse proxy on nginx and I have my webflow blog properly set up on a subdomain of my website. I have the href prefix set to this subdomain. Everything works fine, except for one thing: when I submit a search my blog’s search results page, I’m taken to /search, instead of /prefix/search. So I end up seeing a 404 from my website.

So, it seems that the href prefix isn’t applied when routed to search results.

I see an issue has been opened last year:
https://wishlist.webflow.com/ideas/WEBFLOW-I-1955
but since I couldn’t find a forum topic, I’m thought this would be a better place to ask it.

Thanks for the help!

Good news - I ended up figuring out a quick and easy solution!

Add a custom code element to your search page and include this inside a <script> tag:

var forms = document.querySelectorAll('.search-results-form');    
for (var i = 0; i < forms.length; i++) {
if (forms[i].getAttribute('action')) {
    forms[i].setAttribute('action', '<your_prefix_here>/search')
    }
}

Hi @michael_green thanks for providing the code! Very helpful, however, where do you get the class ‘.search-results-form’ ? Was his a local class for your project? I’ve tried, and I still don’t have the prefix set on this page.