What is the x-nf-request-id header?
Web servers and web browser communicate using a protocal HTTP - Hypertext Transfer Protocol. Both web browsers and web servers use something called headers as part of this protocol.
The headers that web browsers send are called “request headers” because the browser in making an “HTTP request”.
The web servers headers are called “response headers” because web servers send an “HTTP response”.
Netlify creates a unique HTTP response header for each request it replies to - the
x-nf-request-id response header. Even if the response is a 404 or a 301 redirect status - Netlify’s system adds this header.
Why is the x-nf-request-id header important? Why did Netlify Support ask for it?
This header, again, is unique for each individual HTTP response. Using this one header, our support team can find the exact HTTP response (and request) associated with it.
We could ask you for you for the following details to find the HTTP request and response:
- the complete URL requested
- the IP address for the system making the request
- the IP address for the CDN node that responded
- the day of the request
- the time of the request
- the timezone the time is in
Instead, we just ask for the x-nf-request-id header and we then don’t need the details above. The header alone allows us to search our logs and find the exact HTTP response (and the request which generated it).
To summarize, it is much less work (in most cases) for both the person using Netlify and our support team to ask for the
x-nf-request-id instead of the list of details above.
How do I find the x-nf-request-id header?
There are many ways to see the HTTP request/response header for your HTTP requests. The simplest is probably to use your web browsers “devtools” (developer tools) to see the headers.
1. Open the developer tools for your browser
For each browser, they may be a different way to do this. As I am often using Chrome for testing, F12 will open the network tab of devtools automatically.
Links to documentation about how to open dev tools for various web browsers:
- Chrome → https://developers.google.com/web/tools/chrome-devtools/open
- Firefox → https://developer.mozilla.org/en-US/docs/Tools/Web_Console/Opening_the_Web_Console
- Safari → https://support.apple.com/guide/safari/use-the-developer-tools-in-the-develop-menu-sfri20948/mac
- Edge → https://docs.microsoft.com/en-us/microsoft-edge/devtools-guide-chromium#open-the-devtools
2. Click on the ‘Network’ tab
Once you have devtools open, click on the network tab of the devtools.
There won’t be any data there yet. This header information if only available for HTTP requests which occur after the devtools are opened.
3. Generate the HTTP request
Now, it is time to generate HTTP traffic with the devtools open. This can be done by navigating to the URL where are are trying to capture this header or simply by refreshing the page if you are already at the URL in question.
4. Find the header
When web pages load, there are typically many HTTP request for multiple assets. Find the request which of interest. This might be for a particular file or it might be for the base URL itself.
Click on the request you are interested in and find the http response (not request) headers. Each devtools is slightly different so please consult your browser’s documentation if there are questions about how to find this.
For example, in Chrome, after clicking on the request - then click on the “Headers” tab to see these headers.
5. Copy/paste (PLEASE NO SCREENSHOTS!!!) the x-nf-request-id header
Yes, I wrote “please no screenshot” in all capitals and used three escalation points. Please copy/paste the text for the
Why copy/paste? Well, to search for your HTTP request/response, we need to enter this as text into a tool. If you send us a screenshot, we need to type this forty-four character string in by hand. As these are hexadecimal strings, they are not “human readable” in a traditional sense.
Please note we will be unable to assist if we can’t copy/paste the
Now, I’m going to almost break my own rule so show what these headers look like. Yes, I’m included screenshots below. Again, though, no one is going to need to type these headers in so I’m not (technically) breaking any rules.
As always, if there are questions about this, please let us know with a comment here.