🎉 Requestly joins BrowserStack to build the future of application testing. Read more

HTTP Headers

Refresh

HTTP Header

The HTTP Refresh response header instructs a web browser to either refresh or redirect the page after a specified period once the page has fully loaded.
It functions exactly like using <meta http-equiv="refresh" content="..."> in HTML.

Header typeResponse header
Forbidden request headerNo

Syntax

Syntax

http
Refresh: <time>
Refresh: <time>, url=<url>
Refresh: <time>; url=<url>

<time>

A non-negative number of seconds after which to refresh the page. Fractional parts are recognized but ignored; you should only specify integers.

<url> Optional

If present, the browser will redirect to the specified URL instead of refreshing with the current URL. This URL can be quoted or unquoted. The url= prefix is case-insensitive and optional.

Directives

Examples

This section provides practical examples on how to refresh a webpage after a specified period and redirect to a different URL seamlessly.

To refresh a webpage 5 seconds after it fully loads, you can use the following header. This instructs the browser to reload the page after a set time interval, enhancing user experience in scenarios like showcasing rotating banners or auto-updating content:

Refresh: 5

Similarly, you can redirect visitors to another page after a certain duration. This is useful for automatic navigation or login redirects:

Refresh: 5; url=https://example.com/

How to Modify Header using Requestly

Requestly is a powerful Chrome extension that allows you to modify HTTP headers, including the Refresh header. This is especially useful for testing how your application or website handles automatic page reloads or redirects during development or debugging. Steps to Modify the Refresh Header:

  1. Install and open the Requestly Chrome extension. You can find it on the Chrome Web Store.
  2. Create a new rule: Click on “Create Rule” and choose “Modify Headers” from the list of available rule types.
  3. Add a new header modification:
    • Under “Action”, select “Add” or “Override”.
    • In the “Header Name” field, enter Refresh.
    • In the “Header Value” field, enter your preferred refresh value (e.g., 5; url=https://example.com).
  4. Set the URL condition: Specify the URL or pattern where this header change should apply (e.g., https://your-website.com/*).
  5. Save the rule.

Once set up, Requestly will inject the Refresh header into all matching requests, allowing you to control page refresh timing or redirects for testing purposes.

Modifying the Refresh header can help you simulate automatic page reloads or timed redirects to see how your site or app behaves, making it easier to troubleshoot or optimize user experience.