.. _how-it-works: ============ How it works ============ .. _how-it-works-payload: The ``_ss`` parameter ===================== ``_ss`` is base64-encoded JSON with two keys: ``p`` The ``tx_solr`` part of the query string, e.g. ``tx_solr%5Bq%5D=foo&tx_solr%5Bpage%5D=2``. ``s`` A token: the first 12 bytes of ``HMAC-SHA256(encryptionKey, "solr-shield")``, base64url-encoded (16 characters). The token is stateless and does not expire, so filter and pagination links keep working for as long as the TYPO3 ``encryptionKey`` stays the same. Rotating the ``encryptionKey`` invalidates every link that is already out there, including links indexed by search engines. .. _how-it-works-links: Links ===== Two PSR-14 listeners rewrite generated URLs that contain ``tx_solr`` parameters: ``AfterUriIsProcessedEventListener`` EXT:solr's ``SearchUriBuilder``: facets, pagination and sorting. ``AfterLinkIsGeneratedEventListener`` Every other ``typolink()``. Links that still contain EXT:solr's ``###tx_solr:…###`` placeholders are link templates that EXT:solr fills in later; they are left to the first listener. Other query parameters stay as they are: .. code-block:: text Before: /search?L=1&tx_solr[q]=foo&tx_solr[filter][0]=type:pages After: /search?L=1&_ss=eyJwIjoidHhfc29sciU1QnElNUQ9Zm9v… .. _how-it-works-forms: Forms ===== The middleware ``maikschneider/solr-shield-html`` rewrites HTML responses. It renames every ``name="tx_solr[`` attribute to ``name="_s[`` and adds a hidden ``_ss`` field with an empty payload to each form that contains such a field. Submitting the form sends ``_s[…]`` plus ``_ss``, so the search form works without JavaScript. .. _how-it-works-range-facets: Range facets ============ EXT:solr's date and numeric range facets build their URL in the browser: ``facet_daterange_controller.js`` and ``facet_numericrange_controller.js`` replace the ``___FROM___`` and ``___TO___`` placeholders of a URL template and assign the result to ``window.location``. With URI obfuscation, the template's ``tx_solr`` parameters sit inside ``_ss``, where these scripts cannot find the placeholders, and the navigation bypasses ``solr-shield.js``. The middleware ``maikschneider/solr-shield-html`` therefore points every ``