Uniform does’t work on homepage or any page using the second language

Hi.

I’m using Kirby v2 and Uniform v2 on a multi language page and can’t get the uniform to work on all pages. I read the previous threads on this issue but can’t still get it to work.

I have a form and the logic in the site footer (snippet) and it works great on all the subpages (on the main language) but not on the home page. The form action looks like this:

action="<?php echo $page->url()?>/#main-footer"

I have tried to add and remove the “/” before #main-footer but still the same problem.
In Chrome Dev Tool I can see that Request Headers looks like this on the home page:

:authority: domain.com
:method: POST
:path: /
origin: https://domain.com
referer: https://domain.com/

On a subpage (/products for example) where the form works the Request Headers looks like this:

:authority: domain.com
:method: POST
:path: /products/
origin: https://domain.com
referer: https://domain.com/products

I’m guessing that the problem is that on the home page the origin ends without the trailing “/” but the referer do. I want my url:s to end without a trailing “/” so I have this inside my .htaccess:

# Remove Trailing Slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]

Also. If I switch to the second language (url: https://domain.com/se/produkter) the form does not work on any pages. Request Headers looks like this then:

:authority: domain.com
:method: POST
origin: https://domain.com
referer: https://domain.com/se/produkter

This is starting to drive me crazy. I really hope some one can help me out here…

What if you remove the action attribute?

Same result after removing the action attribute.

No one? @mzur any ideas?

Do you really use Uniform v2 and not v3 for Kirby 2?

@mzur How about separating the two versions?

Yes it’s Uniform v2. It’s and old site and I don’t want to get stuck in an update at the moment… But if Uniform v3 will fix this issue, it might be worth it.

@texnixe What do you mean by that?

@felixbridell Could you open your browsers developer tools in the network tab, set it to “persist logs” (in Firefox, Chrome should have something like that, too) and then submit the form so that it fails? Then please show us a screenshot of the whole network log.

@mzur I was wondering if it wouldn’t make sense to have two separate repos for the different Kirby versions, K2 and K3?

In my opinion, no. The versions can be separated very well with different branches and releases. Do you have many support requests from people who confuse the Uniform versions?

No, not really. Maybe it’s just confusing for me.

Here you go @mzur
hope you can find some thing.


That’s too much noise in the log, sorry. Could you enable the filter for HTML responses only? Your first screenshot indicates that the server uses PHP 7.2. I don’t know if Kirby 2 or Uniform v2 even support that version. Maybe that’s the cause.

@mzur Kirby 2 definitely supports PHP 7.2, and I don’t think that’s the issue. At least I don’t have problems with PHP 7.2 and Kirby 2 and your plugin, not even on the home page.

Did you use Uniform v2, too?

I used the version on the kirby-2 branch, whatever that is.

Hmmmm, filter for HTML responses only? Like this?

I have Uniform running on a multilang site with the same form on the home page and sub pages. It works fine. Are you sure it not the .htaccess rules interfering, or some other server setting?

I have the / in my action.

action="<?= $page->url() ?>/#newsletter" method="POST"

The only thing i probably did differently was to use a shared controller, but I dont think that matters.

I tried to remove the

# Remove Trailing Slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]

from the .htaccess but with the same results, form not working on home page.

Can you post your full .htaccess, including where you put the trailing slash rules?

I have RewriteBase / enabled in mine.