Questions tagged [http-request]

Use it for questions about HTTP requests, sending and receiving requests, status codes and more.

Filter by
Sorted by
Tagged with
10 votes
1 answer

Returning alternate HTTP codes for unpublished node

I'm trying to return the 404 page instead of 403 response for unpublished nodes in Drupal 8. I tested kernel response subscriber, but found the code I was using would only change the status code to ...
oknate's user avatar
  • 14.1k
26 votes
3 answers

How to check if the current page is a 404 error from a module/template?

How to check, in D7, if the current page is returning a 404 error from a module/template?
Andrey Rudenko's user avatar
10 votes
6 answers

Friendly error page to replace WSOD

This should be the easiest thing to do, but for some reason I just can't get it done. I'm trying to get a friendly static error page to replace nasty 500 scenarios. For now I'm just trying to ...
Tommi Forsström's user avatar
1 vote
1 answer

How to get the uncached version of request headers?

We need to programmatically get the request headers using the mymodule_preprocess_page hook. To do this we tried the following, however, because we have CDN, Varnish, and Drupal Cache all enabled, the ...
usernameabc's user avatar
  • 2,676
1 vote
1 answer

Sub request doesn't take care of the language

I have defined a route as follow: mymodule.node_summary: path: '/node/{node}/summary' options: parameters: node: type: 'entity:node' defaults: _controller: '\Drupal\...
Baud's user avatar
  • 570
10 votes
5 answers

error 500: Premature end of script headers: index.php

Everything works except the /node/[nr]/edit page of only one content type page. And it's not for every page of this specific content type. Only one. So let's say I have a content type "product" and ...
elterr1ble's user avatar
5 votes
3 answers

How to issue 404 from a KernelEvents::REQUEST event

I'm trying to issue a 404 from a KernelEvents::REQUEST event, but it's resulting in the following error: Fatal error: Maximum function nesting level of '256' reached, aborting! in /var/www/vendor/...
leon.nk's user avatar
  • 386
3 votes
0 answers

Site is down due to MySQL error but it returns 200/OK

A site I help administer was showing a uncaught exception page. Additional uncaught exception thrown while handling exception. PDOException: SQLSTATE[HY000] [2002] Can't connect to local MySQL ...
Joe Corneli's user avatar
3 votes
2 answers

How to show a node but return HTTP 404 response

I want to show an existing page(node) normally but return a HTTP404/410 etc instead of HTTP200. How can I do it? Is there any simple way to do it?
AgA's user avatar
  • 1,651
2 votes
0 answers

How can I access nested data?

Im currently using Drupal's http client manager module to pull data from a json endpoint. I am having trouble getting this to work for a nested structure like this. { count: 2431 page_info: [] ...
tnum's user avatar
  • 21
1 vote
1 answer

Setting exposed filter default value from query string

I have a view which show products and an exposed filter block (category, manufacturer, price). I want to set category default value from URL, like this: /browse-products/category-id though, I wrote ...
Wisamx's user avatar
  • 53
1 vote
2 answers

Making an HTTP subrequest causes CurrentRouteMatch to have the wrong route

For complicated and unpleasant reasons[*], I want to embed entity data from the JSONAPI module inside JSON returned from a REST module resource. I am trying to do this by making an HTTP subrequest to ...
joachim's user avatar
  • 846
0 votes
1 answer

Problem with cURL

I've run into a strange issue. I have a few simple lines CURL code for calling an api service. This code runs perfectly fine when running outisde of Drupal (in php file in browser and cli), but when ...
lordg's user avatar
  • 705
0 votes
2 answers

How to redirect the user to an external website with POST data?

I want to implement an offsite payment method and everything is going well except the fact that I can't find how to redirect the user to the offsite payment gateway after submitting the cart checkout ...
Sianurh's user avatar