5

I just installed Boost module for Drupal 7, but now my Webforms and dynamic blocks like commerce shopping cart block isn't working. It's most likely cached, but what are some methods of getting these dynamic blocks to work? I already added exclude paths for admin/*, user/* and checkout/* so it doesn't cache those pages.

1

As @duckx said, the problem was in the .htaccess file. Because he posted an image, I found it hard to compare it with my file. Here's the final .htaccess I'm using, that so far it works.

List of modifications:

  1. I've added the GZIP lines as I found that in another post (in the Drupal forums)
  2. Changed RewriteRule .* - [S=2] to RewriteRule .* - [S=3]. The [S=N] part specifies how many lines to skip. So if you remove the GZIP part, you might need to change that number.

On an unrelated topic, I'm also using the v2 of ReCaptcha (No-Captcha ReCaptcha) and it does not need the Boost Captcha module.

.htaccess file as I'm using it, doing Copy&Paste should work just fine:

    ### BOOST START ###

  # Allow for alt paths to be set via htaccess rules; allows for cached variants (future mobile support)
  RewriteRule .* - [E=boostpath:normal]

#  # Apache 2.4 bug workaround
#  # Enables Search from home page https://drupal.org/node/2078595#comment-8724321
#  RewriteCond %{REQUEST_METHOD} ^(POST)$
#  RewriteCond %{REQUEST_URI} /
#  RewriteRule .* / [S=3]

  # Caching for anonymous users
  # Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server OR https request
  RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [OR]
  RewriteCond %{REQUEST_URI} (^/(admin|cache|misc|modules|sites|system|openid|themes|node/add|comment/reply))|(/(edit|user|user/(login|password|register))$) [OR]
  RewriteCond %{HTTPS} on [OR]
  RewriteCond %{HTTP_COOKIE} DRUPAL_UID [OR]
  RewriteCond %{ENV:REDIRECT_STATUS} 200
  RewriteRule .* - [S=3]

  # GZIP
  RewriteCond %{HTTP:Accept-encoding} !gzip
  RewriteRule .* - [S=1]
  RewriteCond %{DOCUMENT_ROOT}/cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz -s
  RewriteRule .* cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz [L,T=text/html,E=no-gzip:1]

#  # Apache 2.4 bug workaround
#  # Enables caching of index/ home page
#  RewriteCond %{REQUEST_URI} ^/index\.php$
#  RewriteCond %{DOCUMENT_ROOT}/cache/%{ENV:boostpath}/%{HTTP_HOST}/\_%{QUERY_STRING}\.html -s
#  RewriteRule .* cache/%{ENV:boostpath}/%{HTTP_HOST}/\_%{QUERY_STRING}\.html [L,T=text/html]

  # NORMAL
  RewriteCond %{DOCUMENT_ROOT}/cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html -s
  RewriteRule .* cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]

  ### BOOST END ###
1

It seems you check Cache blocks(block caching) in config/development/performance. Try to uncheck that. When you work with Boosts it is not require use that feature.

  • those things are already off. I'm just trying to submit a webform when boost is on. – Patoshi パトシ May 19 '16 at 14:46
1

It helps to look at the big picture of what Boost does to understand the problem; Boost is storing compressed rendered HTML pages and bypassing Drupal to serve them directly to anonymous users. It's a good server-centric solution for content delivery to a mostly anonymous userbase. What you're looking to do is identity when/where Drupal needs to take over to render dynamic content.

You could try some sort of progressively decoupled path. You can identity the blocks of content that need to be evergreen and try to work your site to load those dynamically on the frontend. It sounds like you new a few contrib module blocks to be dynamic. You might get by with AJAX Blocks configured on the contrib blocks, just note that they might not be compatible AJAX Blocks and you might have to figure out why and perhaps debug/implement your own solution.

Another path is to just quickly identify when Boost is no longer needed based on some user intent and disable it. For example, once gets redirected to the cart page or browses to a user login page, you should redirect the user to the secure version of your site; Boost can be configured to bypass the cache on a SSL request.

There's no one-size-fits-all solution; depending on your userbase, caching requirements, etc., one path might work better than another.

  • I'm just trying to get a webform to submit when boost is on. – Patoshi パトシ May 19 '16 at 14:46
1

Forms not submitting was due to boost v1.1 generating the wrong .htaccess data. I reverted to 1.0 and then grabbed that code and used that instead. Then switched back to 1.1

http://prntscr.com/b8qnym -- comparision of the 1.1 and 1.0 .htaccess code generated.

I can also confirm that the 1.0 version's htaccess code works on 1.1

The 1.1 generates an incorrect .htaccess code which renders all forms nonfunctioning even in the admin screens.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.