• Our booking engine at tickets.railforums.co.uk (powered by TrainSplit) helps support the running of the forum with every ticket purchase! Find out more and ask any questions/give us feedback in this thread!

National Rail Enquiries - "Bad Request"

Status
Not open for further replies.

EbbwJunction1

Established Member
Joined
25 Mar 2010
Messages
1,565
I've been trying to use National Rail Enquiries recently, but I've often not been able to, as it gives me this response:

"Bad Request
Your browser sent a request that this server could not understand.
Size of a request header field exceeds server limit."

Now, apart from the fact that on many of the occasions I haven't asked for anything complicated, I simply don't understand what this rejection notice actually means!

Does anyone know what it means, and do you have any suggestions of how I can stop this happening, please?

Thanks.
 
Last edited by a moderator:
Sponsor Post - registered members do not see these adverts; click here to register, or click here to log in
R

RailUK Forums

EbbwJunction1

Established Member
Joined
25 Mar 2010
Messages
1,565
Thanks, but I've tried several times over the past few weeks and sometimes it works straight away and others not at all. The annoying thing is that sometimes it works to begin with and then stops working!
 

eastwestdivide

Established Member
Joined
17 Aug 2009
Messages
2,551
Location
S Yorks, usually
Do you have an example of a journey request that causes it to fail?

And if you can open a private browser window (in Chrome an "incognito" window), does it still fail then?
 

DelW

Established Member
Joined
15 Jan 2015
Messages
3,880
Have you tried the "reset all" command at the bottom left of the journey planner entry page? Sometimes that has worked for me when it's been behaving oddly, presumably because something has been left in an input field without it being visible to me. I have to say I think the OJP is well overdue for an update though.
 

Ken H

On Moderation
Joined
11 Nov 2018
Messages
6,308
Location
N Yorks
Thanks for your advice, but (and I'm really not being funny) can you say them again in English and not Computer, please? I really don't understand what you're saying, so I haven't a clue what to do.
sorry - I was being sarcastic. Its from the IT crowd TV show. Thus the :)
 

EbbwJunction1

Established Member
Joined
25 Mar 2010
Messages
1,565
Do you have an example of a journey request that causes it to fail?

And if you can open a private browser window (in Chrome an "incognito" window), does it still fail then?
Thanks, but I don't, really ... but see below.
Have you tried the "reset all" command at the bottom left of the journey planner entry page? Sometimes that has worked for me when it's been behaving oddly, presumably because something has been left in an input field without it being visible to me. I have to say I think the OJP is well overdue for an update though.
Thanks - this seems to have worked! I did as you suggested, and tried three different journeys, and they all worked. Another thing that it didn't seem to like was when I inserted the "select railcard" option at the beginning. It often just offered me the adult price and I had to add the railcard as a separate action. However, on all three occasions now, it's been happy to offer me a discounted price.

So, (fingers and other digits crossed!) it may be okay ... !
 

4COR

Member
Joined
30 Jan 2019
Messages
460
So to elaborate on what this issue is: when a browser makes a request to a server, the request has "headers" which include cookies (which save a "state" and might contain eg login/session info, or something that the user has previously done), as well as other information like which browser is being used, instructions to the server about what type of response will be accepted, etc.. Depending on the type of request, there may also be a payload (or request body) - this is often used in web forms.

Servers have predefined limits for lots of things - these include the address length, and the headers. The limits are often in place to avoid various issues around resources and security, and the error message is indicating that one of these limits have been exceeded.

A common cause I have seen before i(in all kinds of software) is where a query or a preference (or maybe in this case, previous journey options) expand to a size not otherwise envisaged - I've found bugs like this when trying to batch process data in systems I work with: testing used much smaller data sets!

Clearing browser cache/history probably removed any previous data and got rid of the data causing the header to be too long.

Bet you wish you hasn't asked now ;)
 

Envoy

Established Member
Joined
29 Aug 2014
Messages
2,478
I have also had the ‘Bad Request’ message come up on the National Rail site & have given up on them in favour of a split ticket site that always works. (Plus of course, it shows me the cheapest way of getting from a to b which National Rail does not).
 

EbbwJunction1

Established Member
Joined
25 Mar 2010
Messages
1,565
sorry - I was being sarcastic. Its from the IT crowd TV show. Thus the :)
Ah .... :D
So to elaborate on what this issue is: when a browser makes a request to a server, the request has "headers" which include cookies (which save a "state" and might contain eg login/session info, or something that the user has previously done), as well as other information like which browser is being used, instructions to the server about what type of response will be accepted, etc.. Depending on the type of request, there may also be a payload (or request body) - this is often used in web forms.

Servers have predefined limits for lots of things - these include the address length, and the headers. The limits are often in place to avoid various issues around resources and security, and the error message is indicating that one of these limits have been exceeded.

A common cause I have seen before i(in all kinds of software) is where a query or a preference (or maybe in this case, previous journey options) expand to a size not otherwise envisaged - I've found bugs like this when trying to batch process data in systems I work with: testing used much smaller data sets!

Clearing browser cache/history probably removed any previous data and got rid of the data causing the header to be too long.

Bet you wish you hasn't asked now ;)
Errr ... yes! :D
I have also had the ‘Bad Request’ message come up on the National Rail site & have given up on them in favour of a split ticket site that always works. (Plus of course, it shows me the cheapest way of getting from a to b which National Rail does not).
Thanks; I haven't used a split ticket site, so maybe I should - which one do you use, please?
 

Envoy

Established Member
Joined
29 Aug 2014
Messages
2,478
Ah .... :D

Errr ... yes! :D

Thanks; I haven't used a split ticket site, so maybe I should - which one do you use, please?

I would not mess around with your computer if like me, all the other websites work normally. (I use Safari as the browser on an Apple i-mac).

www.TrainTickets.com and https://new.trainsplit.com are two websites that I use. They will show fares where splitting the ticket at place(s) the train(s) call at can reduce the price. On the second site, you need to click ‘proceed’ to see the split points. If you are eligible for a Railcard and shop at Tesco, £10 worth of Clubcard vouchers will get use a Railcard which would cost £30 from the railways.
 

EbbwJunction1

Established Member
Joined
25 Mar 2010
Messages
1,565
I would not mess around with your computer if like me, all the other websites work normally. (I use Safari as the browser on an Apple i-mac).

www.TrainTickets.com and https://new.trainsplit.com are two websites that I use. They will show fares where splitting the ticket at place(s) the train(s) call at can reduce the price. On the second site, you need to click ‘proceed’ to see the split points. If you are eligible for a Railcard and shop at Tesco, £10 worth of Clubcard vouchers will get use a Railcard which would cost £30 from the railways.
Thank you, that's very interesting - I don't have any thoughts about messing around with the computer!

I've tried the first site for a journey that I'm making tomorrow, and the saving is minimal, so I won't be using it. However, I'll keep an eye on it and use it in the future if I can. I didn't know about the Railcard option from Tesco; I do have a Railcard and I do shop at Tesco, so that's something to think about when I need to renew it.
 

Envoy

Established Member
Joined
29 Aug 2014
Messages
2,478
Thank you, that's very interesting - I don't have any thoughts about messing around with the computer!

I've tried the first site for a journey that I'm making tomorrow, and the saving is minimal, so I won't be using it. However, I'll keep an eye on it and use it in the future if I can. I didn't know about the Railcard option from Tesco; I do have a Railcard and I do shop at Tesco, so that's something to think about when I need to renew it.
Pleased to be of help. Don't forget that the Tesco Clubcard coupons that they send you through the post have a life of 2 years. If you just hand them in at the till, you simply get the face value knocked off your bill but by using them, you gain value - in the case of Railcard £20. You will need to go on the Tesco Clubcard website and select Railcard and it will ask you to input the numbers of the coupons that you wish to ‘cash in’ for the Railcard. (Any surplus ‘ money’ over will go back to your account as points). Tesco will then e-mail you a code that you use on the actual Railcard site.

Regarding splits: it often is the case that a split is made where you change trains to a different company although this is not always the case. Also check both the sites I gave you to check if they come up with any thing different for the same journey. Note also that ‘Advance’ tickets will be for specific trains but with ‘Anytime’, you have more freedom.
 

EbbwJunction1

Established Member
Joined
25 Mar 2010
Messages
1,565
Pleased to be of help. Don't forget that the Tesco Clubcard coupons that they send you through the post have a life of 2 years. If you just hand them in at the till, you simply get the face value knocked off your bill but by using them, you gain value - in the case of Railcard £20. You will need to go on the Tesco Clubcard website and select Railcard and it will ask you to input the numbers of the coupons that you wish to ‘cash in’ for the Railcard. (Any surplus ‘ money’ over will go back to your account as points). Tesco will then e-mail you a code that you use on the actual Railcard site.

Regarding splits: it often is the case that a split is made where you change trains to a different company although this is not always the case. Also check both the sites I gave you to check if they come up with any thing different for the same journey. Note also that ‘Advance’ tickets will be for specific trains but with ‘Anytime’, you have more freedom.
Thanks very much; that's very useful.

My Railcard has a good while to go yet, so I won't need to buy a new one yet. However, I'll try to remember this option when I do. The other site's suggestions are minimal as well, but I'll bear them both in mind for the future.
 

4COR

Member
Joined
30 Jan 2019
Messages
460
I would not mess around with your computer if like me, all the other websites work normally. (I use Safari as the browser on an Apple i-mac).

Clearing caches and cookies isn't really "messing around with your computer" - though really, the fix should ideally be from the NRE side... I would be placing my suspicions (from a little inspection) towards the length of the cookie string - mine is already 6kb in size - a usual limit is 8kb, so it may well be that growing in an unplanned way - but clearing cache and cookies will fix it (though at the expense of needing to log in again everywhere if done axcross the board).
 

Mcr Warrior

Veteran Member
Joined
8 Jan 2009
Messages
11,854
Don't forget that the Tesco Clubcard coupons that they send you through the post have a life of 2 years. If you just hand them in at the till, you simply get the face value knocked off your bill but by using them, you gain value - in the case of Railcard £20. You will need to go on the Tesco Clubcard website and select Railcard and it will ask you to input the numbers of the coupons that you wish to ‘cash in’ for the Railcard. (Any surplus ‘ money’ over will go back to your account as points). Tesco will then e-mail you a code that you use on the actual Railcard site.
Is the "exchange rate" still effectively £30 of Railcard for every £10 of Tesco Clubcard vouchers redeemed?
 

Envoy

Established Member
Joined
29 Aug 2014
Messages
2,478
Is the "exchange rate" still effectively £30 of Railcard for every £10 of Tesco Clubcard vouchers redeemed?
See the transport section on the Tesco Clubcard site:> https://secure.tesco.com/clubcard/browse/travel/transport/4294967286|4294967264.cat

The Tesco deal is excellent because people who don’t normally use the trains might be tempted to get the Railcard for only £10 in Tesco vouchers and then take a rail journey for the first time in years - which will hopefully lead to further rail travel. However, those same people might well be reluctant to splash out £30 for the Railcard direct from the railways.

It sounds to me like the National Rail website is overloading cookies onto our computers and thus leading to “Bad Request”. If we remove all cookies from our computers, other sites that remember us for log in will forget our login details and we will have to manually insert them again. Seems like the Rail Delivery Group are not delivering!
 

DelW

Established Member
Joined
15 Jan 2015
Messages
3,880
Thanks - this seems to have worked! I did as you suggested, and tried three different journeys, and they all worked. Another thing that it didn't seem to like was when I inserted the "select railcard" option at the beginning. It often just offered me the adult price and I had to add the railcard as a separate action. However, on all three occasions now, it's been happy to offer me a discounted price.

So, (fingers and other digits crossed!) it may be okay ... !
I'm glad to hear it's worked, at least so far. I routinely click that reset option before putting in a new journey, particularly if it has opened showing anything still left from previous searches.
 

Pigeon

Member
Joined
8 Apr 2015
Messages
804
It sounds to me like the National Rail website is overloading cookies onto our computers and thus leading to "Bad Request". If we remove all cookies from our computers, other sites that remember us for log in will forget our login details and we will have to manually insert them again. Seems like the Rail Delivery Group are not delivering!

Your browser really ought to have a facility to remove cookies only from specific domains, so other sites are unaffected. Surely it does somewhere?

But more fundamentally, as I said: the OJP needs rewriting to not use cookies. There's no excuse for any site to depend on cookies except for logging in and only for logging in (and any site that claims any cookie other than a login cookie is "essential" is lying). Data for any functionality which requires a login to be established should be held on the server. Data for any functionality which doesn't need logging in can be more appropriately handled by means such as embedded form data or URL parameters, and the data the OJP sends back and forth for journey planning is exactly of that type. This method would avoid the errors in question because (a) embedded form data can be as long as you like, unlike HTTP headers, and (b) it automatically gets lost when you close the tab or browse it to another site, so the gradual accumulation of rubbish until there's so much it starts breaking things doesn't have a chance to occur.

Even as it stands the OJP will happily do the most important bit of journey planning - finding out the times of trains and connections - without requiring cookies, receiving the data by means of URL parameters; it even provides an admittedly rather crappy and useless minor subset of fares information as well as the times. I have written my own web page to query it over this interface because the "real" web page is such a gruesomely unusable piece of crap (like most websites these days). It's not until you try and look up a more complete and useful set of fares that the OJP starts insisting unnecessarily on using cookies. So having failed to discover any alternative means of making it disgorge the data I didn't bother implementing that bit, but as I recall it uses one for a session ID - which is a server-side option that by default does use URL parameters or form data, and doesn't insist on cookies unless you tell it to - and one to pass the same journey planning data that the cookieless part of the interface manages perfectly well to pass in the URL. Neither purpose requires cookies, and using them is a clear instance of bad design - deliberately in the case of the session ID, and apparently out of some combination of thoughtlessness, laziness and ignorance in the case of the journey planning data.

Of course, it is also an instance of bad design that having chosen an inappropriate manner of passing the journey planning data in the first place, it then misuses the properties of the chosen method to allow old garbage to accumulate until it breaks...
 

extendedpaul

Member
Joined
11 Nov 2010
Messages
690
Location
Caerphilly and Kent
Had a call from a friend trying to plan a journey for next week and then book an advance ticket but he was constantly getting a" Bad Request" message on National Rail Enquiries. Tried myself with same outcome.

I don't want to clear cache as that often loses saved passwords. I advised him to use trainline to plan, but forgot to say not to book there ... which needless to say he did. They must be getting extra business from this situation.
 

Bevan Price

Established Member
Joined
22 Apr 2010
Messages
7,343
Clearing caches and cookies isn't really "messing around with your computer" - though really, the fix should ideally be from the NRE side... I would be placing my suspicions (from a little inspection) towards the length of the cookie string - mine is already 6kb in size - a usual limit is 8kb, so it may well be that growing in an unplanned way - but clearing cache and cookies will fix it (though at the expense of needing to log in again everywhere if done axcross the board).
I set my browser to delete all cookies when I exit. Yes, there can be a minor inconvenience having to re-enter your details each time you visit some sites, but cookies are something of a snoopers charter, enabling outsiders - some malicious - to study your on-line behaviour. To boost this, I periodically use free versions of utilities to clear rubbish from caches, etc.
(ccleaner, MooO disc cleaner, etc.). Sometimes as much as 500Mb of trash can be removed in a single scan - especially after Windows updates.
 

4COR

Member
Joined
30 Jan 2019
Messages
460
I set my browser to delete all cookies when I exit. Yes, there can be a minor inconvenience having to re-enter your details each time you visit some sites, but cookies are something of a snoopers charter, enabling outsiders - some malicious - to study your on-line behaviour. To boost this, I periodically use free versions of utilities to clear rubbish from caches, etc.
(ccleaner, MooO disc cleaner, etc.). Sometimes as much as 500Mb of trash can be removed in a single scan - especially after Windows updates.
I guarantee there are not 500MB of cookies though - Windows (or any other OS) updates are not cookies...
 

trover

Member
Joined
16 Feb 2022
Messages
188
Location
North West
I experienced the same when specifying certain interchange station, however the desired itinerary can be generated easily using Trainsplit (offered the cheapest advance fare for the journey ofc).
 

AlbertBeale

Established Member
Joined
16 Jun 2019
Messages
2,755
Location
London
I set my browser to delete all cookies when I exit. Yes, there can be a minor inconvenience having to re-enter your details each time you visit some sites, but cookies are something of a snoopers charter, enabling outsiders - some malicious - to study your on-line behaviour. To boost this, I periodically use free versions of utilities to clear rubbish from caches, etc.
(ccleaner, MooO disc cleaner, etc.). Sometimes as much as 500Mb of trash can be removed in a single scan - especially after Windows updates.

Yes - it's good practice to have your browser set to clear cookies every time you finish using it (assuming you let sites put cookies on your machine in the first place). Some log-in stuff can be automated on your own machine, rather than letting the website concerned do it with cookies, and keep track of you while they're at it.
 
Status
Not open for further replies.

Top