This article explains how to troubleshoot a Presspage Newsroom subfolder integration that isn't working correctly.
Setting up a subdomain integration is generally straightforward. Setting up a subfolder configuration can be trickier, since web servers differ and can be configured in many ways. Use the steps below to check your configuration and resolve common issues.
Table of contents:
- What to look for
- What a default subfolder configuration code snippet looks like
- What does this snippet do?
-
Most frequent issues:
- Query string parameters
- Other conflicting rulesets
- Include all configuration lines
What to look for:
To check whether your subfolder configuration is working, verify the following:
- Does the Newsroom homepage load?
- Do links to individual articles work?
- Does the Search module work?
- Does the Download module work? It should trigger a direct download of the attached file.
- Does the downwards arrow (see image below) beneath the Headlines module work? It should load the remaining articles that are part of that headlines module.
If you cannot answer all above questions with 'yes', you may be dealing with a subfolder config issue.
What a default subfolder configuration code snippet looks like:
Caution:
The clienthash as seen in these examples is different for every account. Do not copy it from this article into your configuration — it will not work. Use the value provided for your own account.
Apache:
SSLProxyEngine on
<Location "/subfolder-example">
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^.*/subfolder-example(.*)? https://client.presspage.com/$1?subfolder=1&clienthash=12e687a8eb2f0ee0ce7e30ff2b2bb1db&trail=%{REQUEST_URI} [QSA,L,P]
</IfModule>
</Location>IIS:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Presspage Newsroom" stopProcessing="true">
<match url="^subfolder-example(.*)" />
<serverVariables>
<set name="HTTP_X_FORWARDED_HOST" value="www.example.com" />
</serverVariables>
<action type="Rewrite" url="http://client.presspage.com/{R:1}?subfolder=1&clienthash=12e687a8eb2f0ee0ce7e30ff2b2bb1db&trail=/{R:1}" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>Nginx:
location /subfolder-example {
resolver 8.8.8.8;
rewrite ^/subfolder-example/(.*) /$1 break;
proxy_pass https://client.presspage.com$uri?subfolder=1&clienthash=12e687a8eb2f0ee0ce7e30ff2b2bb1db&trail=$uri&$args;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host www.example.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_request_headers on;
}If you use a CDN, make sure it passes the client's IP address to the origin, rather than the CDN's own IP address.
What does this snippet do?
The snippet does three things, in order:
- It uses a regular expression to match only URLs that start with the domain's subfolder, plus any characters that follow (including zero characters). These characters are captured as a regex match (
$1orR:1in the snippets above). - If the rule matches, it sets an
X-Forwarded-Hostheader. The value is the domain name itself, without the subfolder, and must match the domain name configured by Presspage in the Presspage backend. - It rewrites the request URL to the
client.presspage.comURL shown in the snippet, inserting the regex match where appropriate.
Without a correctly configured X-Forwarded-Host header, the correct page can't be returned.
Most frequent issues:
Query string parameters
Requests with query string parameters sometimes don't reach the Presspage servers, which causes problems with the Search, Download, and Headlines Modules.
If you use a Web Application Firewall (WAF) or a CDN such as Akamai, Cloudflare, or Amazon CloudFront, make sure these requests aren't filtered out. Query strings should be forwarded to the origin. Also check that caching on your end isn't interfering with this.
Other conflicting rulesets
Check whether any other configuration rules conflict directly with the snippet provided by Presspage. See if you can create an exception, or move the snippet to the beginning of the file so it runs first.
Also check whether another application's rulesets conflict with the snippet.
If you use Sitecore, add the Newsroom subfolder to the "Ignore URL prefix list."
Include all configuration lines
Make sure all configuration lines are included and that the regex in the rule is correct.