Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Page downloads instead of showing: fix wrong content-type headers

OPS-097Medium impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

Every response from your server carries a Content-Type header. It names the file type, for example text/html for a web page, text/css for styles or application/pdf for a PDF. The browser trusts this label to decide what to do.

When the label is wrong, the browser does the wrong thing. A page labelled application/octet-stream is saved as a file. A page labelled text/plain shows its raw HTML. Scripts and stylesheets with the wrong type may be blocked, especially when the server also sends X-Content-Type-Options: nosniff.

Why it costs you leads or sales

A visitor who clicks your ad and gets a file download sees no offer, no form and no checkout. Most will leave at once. Ad spend is still charged for the click.

Where the visit breaks
  1. Ad clickVisitor reaches your URL
  2. Server responseContent-Type: application/octet-stream
  3. Page rendersBrowser downloads a file instead
  4. Form or checkoutNever seen
  5. ConversionNever tracked

The page is served with the wrong type, so nothing after it happens.

Effect on a landing pageExample numbers
Effect on a landing page (example)Correct header: 40 leads per week; Wrong header: 0 leads per week01531400Correct headerWrong headerleads per week

Example: illustrative numbers for a page that gets the same traffic before and during the fault.

How to check if your site has it

Look at the response headers for your key pages: landing pages, thank-you pages, checkout and any URL without a file extension.

Check the Content-Type header
  1. Run curl

    In a terminal, run curl -I https://example.com/your-page and read the Content-Type line. A normal page shows text/html; charset=UTF-8.

  2. Use browser dev tools

    Open DevTools, go to the Network tab, reload, click the first request and look under Response Headers.

  3. Test other browsers and devices

    Some faults appear only through a CDN edge, on mobile, or on one URL pattern. Try a private window too.

  4. Check assets as well

    Look at your CSS and JavaScript files. A wrong type there can break styling or scripts even when the page opens.

Check headers from the command linebash
curl -sI https://example.com/landing | grep -i -E 'content-type|x-content-type-options'
What the header value means for the visitor
Content-Type sentWhat the visitor sees
text/html; charset=UTF-8Page renders normally
text/plainRaw HTML code shown as text
application/octet-streamFile download prompt
application/json or otherData or a download, not a page
Missing headerBrowser guesses; results vary

How to fix it

Find which layer sets the wrong type: the origin server, the app, or a CDN or proxy in front. Compare the headers from the origin and from the public URL if you can reach both.

Fix by platform
  1. Check for stray output and headers

    Deactivate plugins, especially caching, security and redirect plugins, and switch to a default theme to see if the type corrects itself. Search the theme and plugins for header('Content-Type' calls.

  2. Review .htaccess

    Remove any AddType or ForceType lines that apply to PHP or HTML. Regenerate rules by saving Settings > Permalinks.

Nginx: load MIME typesnginx
http {
    include       mime.types;
    default_type  application/octet-stream;
    charset       utf-8;
}
Apache: correct types for HTML and PHPhtaccess
AddDefaultCharset UTF-8
AddType text/html .html .htm
<FilesMatch "\.php$">
    SetHandler application/x-httpd-php
</FilesMatch>
PHP: set the header before any outputphp
<?php
header('Content-Type: text/html; charset=UTF-8');
?>

How to confirm it's fixed

Confirm the fix
  • curl -I shows Content-Type: text/html; charset=UTF-8 for every key page
  • The page renders in Chrome, Safari and Firefox, on desktop and mobile
  • CSS and JavaScript files load with text/css and a JavaScript type
  • The CDN cache has been purged and the public URL matches the origin
  • A test form submission or checkout reaches the thank-you page

How to prevent it happening again

Prevention
  • Re-check headers after server, PHP, CDN or hosting changes
  • Keep server MIME type files up to date after upgrades
  • Review proxy and CDN rules before publishing them
  • Test new landing page templates and redirects in a private window
  • Monitor key pages on a schedule instead of relying on manual spot checks
Before and after the fix

Wrong header

  • Content-Type: application/octet-stream
  • Browser offers a file download
  • No form or checkout is visible

Correct header

  • Content-Type: text/html; charset=UTF-8
  • Page renders as normal
  • Form and checkout are usable

How FunnelGuard handles this

FunnelGuard detects this issue today. A robot visitor opens your funnel pages in a real browser on a schedule, from the EU or the US. If a page downloads or does not render, the journey step fails, so the check catches it. A failure is re-checked from a second region before one alert goes out, with a screenshot and a likely cause.

Questions people ask

Why does my website download a file instead of opening?

The server is probably sending the wrong Content-Type header, such as application/octet-stream, so the browser saves the page instead of rendering it. Check the header with curl -I and fix the server, app or CDN rule that sets it.

What Content-Type should an HTML page use?

Use text/html; charset=UTF-8. This tells the browser to render the response as a web page and read it as UTF-8 text.

Why does my page show raw HTML code?

The response is most likely labelled text/plain, or a script is outputting the page with the wrong header. Set the type to text/html and check for plugins, proxies or rules that override it.

How do I check the Content-Type header of a page?

Run curl -I followed by the URL and read the Content-Type line. You can also open browser DevTools, choose the Network tab, reload and look at Response Headers on the first request.

Can nosniff cause a page or script to stop working?

Yes. With X-Content-Type-Options: nosniff, browsers will not guess the file type. A script or stylesheet with the wrong type is blocked, so fix the type rather than removing the header.

Why does the page work on the origin but download through my CDN?

A CDN rule may rewrite the header, or the CDN may have cached a response with the wrong type. Review response header and transform rules, then purge the cache.

Can a wrong content-type affect my ad conversions?

Yes. If visitors get a download instead of your page, they cannot see the offer or reach the form, and conversion tags never fire. The ad click is still charged.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.