security – Would there be any actual secure, server side way to lock away react routes?

So I don’t know what I am asking is even possible but is there any way, like you can do with static HTML and CSS websites to only let a person see the “/test” route for example if they are verified?

I know this is possible with react-router-dom but as a perfectionist, I want to do it server side with preferably express and my own middleware (using JWT and MongoDB) to check user identities ETC.

Thanks a lot!

9 – How to alter routes defined in route_callbacks?

Usually I alter static routes in routes subscriber:

  protected function alterRoutes(RouteCollection $collection) {
    $route = $collection->get('');
    if ($route) {
      $route->setDefault('_controller', 'Drupalgutenberg_advControllerMediaController::loadMedia');

However I this does not work for routes defined in routes_callback, so this does not work for search route for example:

$route = $collection->get('search.view_node_search');
if ($route) {

So how to alter search route controller?

sea travel – What routes are there to cross the Pacific East-to-West (without flying)?

There are certainly cruises from America to Asia, you’ll need to get to Los Angeles or San Francisco but from there you can get to China (and from there you can get a train or ferry to most places — although sadly not the Philippines, which reminds me I meant to ask a question about that).

For example Princess Cruises Voyage Number H419A (can’t link directly to the page but you should be able to search for that) goes from LA departing April 3 and arrives in Shanghai on April 25. It calls at Honolulu (April 8), Guam (April 17), Taipei (April 21), Okinawa (April 23). I don’t think it runs often, maybe once a year, but it’s definitely there. I’ve seen other similar cruises but they too don’t run often — a travel agent should be able to help.
One web site that seems to offer great searches for specific start and end ports is . (found in this other post)

Alternatively you could go on a cargo cruise, here’s a link for West Coast USA to Asia, they claim they run every month — however that site looks suspiciously like a reseller and they may not actually have what they claim.

Finally, if time and money isn’t an issue you could do it in the other direction, New York to Southamptom on the Queen Mary 2. Take the train or ferry to Europe, then train across Europe to Asia.

usa – Choosing between 2 google map routes

Google Maps takes into account traffic when the data is available. Of course when planning a trip ahead of time, conditions may not be as anticipated. You can set a day and time in the near-future but those are less reliable. If you want to know the best route, check the day you are leaving but for such a long trip, it means that you may not be able to know where exactly will be a good point to stop.

As you can see from your screenshot, Google shows you the distance and estimated time. This makes it easy to calculate the average speed which is more useful than the maximum speed since that is not always possible due to traffic. Even if you manage to go over the limit at times, it won’t make as much difference compared to how much sleep to you take, how long you stop for meals, etc.

For the quickest travel time, follow Google Maps Live which requires a data connection. This allows Google to change the route while your trip is already in progress since traffic conditions will certainly change during that 29+ hour trip. Accidents and road closures allow the drive to adapt dynamically and so the final path may be none of the above.

If you want to plan ahead, reserve a night of hotel in the middle, choose restaurants to stop too, pick one route and plan to follow it with only minor detours. There is some overlap with the two shorter routes and time does not vary that much that it won’t be much loss if it turns out the other one had better traffic the day of your trip.

routes – How do I add items from from the user module to a menu?

The My Account and Log Out links are defined in core/modules/user/
  title: 'My account'
  weight: -10
  menu_name: account
  weight: 10
  menu_name: account
  class: DrupaluserPluginMenuLoginLogoutMenuLink

As you can see they are hardcoded to the account menu. With this in mind, really the best thing to do is simply place both menus next to each other on the Block Overview page. This works for probably 95% of use cases. Your CSS should be written in a way to support that. For the other 5%, you could go as far as to piggyback your own links in a custom module. If you were to do so, it would/could look something like this:

type: module
name: 'My Module'
description: 'Copy user links.'
core_version_requirement: ^8.8 || ^9
package: 'User'
  - user:user


  title: 'My account'
  weight: -10
  menu_name: YOUR_MENU_ID
  weight: 10
  menu_name: YOUR_MENU_ID
  class: DrupaluserPluginMenuLoginLogoutMenuLink

magento2 – Find Routes File For Magento 2 Rest API

I have inherited a Magento 2 site, and I am trying to find the rest api that is handling the checkout. The route is <magento_site>/rest/default/V1/<checkout _information. As is, i have found a benchmark.jmx file that has the route, but no related PHP controller. Where would I look to find the related file(s)?

routes – Inbound path processor is not processing

I’m trying to use an Inbound Path Processor to redirect a path(to a webapp based on this tutorial), but Drupal is not picking it up.

I tried the following code to simply redirect every page on the site to /happy, but after rebuilding the cache, nothing happens; I can navigate the site normally and never get redirected.


namespace DrupalmymodulePathProcessor;

use DrupalCorePathProcessorInboundPathProcessorInterface;
use SymfonyComponentHttpFoundationRequest;

class MyPathProcessor implements InboundPathProcessorInterface {

  public function processInbound($path, Request $request) {
    return '/happy';


Am I using this wrong? What do I need to do to get Drupal to use the path processor?

equipment – How would closing borders and supply routes affect local market prices?

I’m developing a world where governments are freaking out over a perceived threat (not a virus). The stars have disappeared and the gods have seemingly abandoned them. Many leaders have ordered their borders locked down and trade routes closed for various reasons.

Different countries would have the resources they can produce themselves (obviously) but things from outside would be increasingly scarce as time goes on. I know that not having shipments to a desert country would raise the price of the remaining wood products in their markets. But I don’t know how much. I know what each country produces and what they import.

My question:
What is a reasonable scale for increasing scarcity?

I’m mostly looking for a realistic percentage I can add to market prices every week/month to reflect the scarcity. But if a set scale is more realistic let me know.

I know my PCs will be able to exploit this with smuggling and get “hella rich” as they would put it. But in the long run if they waste their time smuggling they will come to the inevitable end of the campaign with too much money and not enough power. I’m letting them know it’s on a timeline so they can make their own decisions.

8 – Alter existing routes doesn’t work

I’m working on a D8 project trying to add custom access rules to some pages.

I want to restrict access to specific users based on their id.

I checked this and seems easy but I can’t make it work!

I want to change the access for the route


But as I didn’t manage to make it work I tried an easier example


(Which also doesn’t work)

So I created my routing file under my_module/src/Routing folder :

namespace Drupalmy_moduleRouting;

use DrupalCoreRoutingRouteSubscriberBase;
use SymfonyComponentRoutingRouteCollection;

 * Listens to the dynamic route events.
class RouteSubscriber extends RouteSubscriberBase {

   * {@inheritdoc}
  protected function alterRoutes(RouteCollection $collection) {
    if ($route_item = $collection->get('contact.site_page')) {
      $requirements = $route_item->getRequirements();
      $route_item->setRequirement('_access', 'FALSE');

After that I added the service file in my_module’s root folder:

    class: Drupalmy_moduleRoutingRouteSubscriber
      - { name: event_subscriber }

But I don’t get Access denied when I visit those pages.

Also, is there any way to test it by using dsm or var_dump?

Any idea/help/suggestion?

theming – How can I customize the 403 page for specific routes?

On a D9 site, with an existing custom 403 page twig. I’ve been requested to show a different, variable, message from the “standard one” for a couple of specific routes.

I’ve tried with theme_preprocess_page__403(&$variables) but I couldn’t determine the original route.

E.g. using Drupal::routeMatch()->getRouteName() I got system.403 instead of the route name I need to check. I’ve checked solutions to find the refer route but none of them seemed to work.

Actually the two routes that need this specific 403 are created programmatically with a *routing.yml and relative controller in a custom module.

I wonder if it is possible somehow to specify the redirect path if the route requirements fails. I didn’t find any documentation about, but that would another way to implements this requirement.