Categories
Mastering Development

React Hook Dependencies – Generic Fetch Hook

I’ve followed many tutorials for how to set up my own custom generic useFetch hook. What I came up with works well, but it is breaking some Rules of Hooks. Mostly, it doesn’t use the "correct" set of dependencies. The generic hook accepts a url, options, and dependencies. Setting the dependencies up as all three […]

Categories
Mastering Development

Using Create-React-App with Apache VirtualHost

I am trying to develop a project for a company. This company has an API that only allows requests from two sources: Their own host, and xyz.localhost. At first, I developed the project with jQuery only (loaded in via CDN). With an Apache VirtualHost setup, this worked — I could access the API. Now, I […]

Categories
CMS Drupal Mastering Development

hook_menu_local_tasks_alter is not invoked during functional tests

I have an implementation of hook_menu_local_tasks_alter in my module, which works fine on my dev environment, but when I try to run my module using BrowserTestBase the hook is not invoked when visiting a node. Why? Here is a mock instance of the hook that I’ve set up just to see if the hook is […]

Categories
CMS Magento Mastering Development

Varnish doesn’t display full page with Magento 2

I’m having a weird issue while configuring Varnish with my Magento 2 store. My setup is such that I’m using a load balancer that routes the requests first to Varnish and then to Apache (as a failover). As soon as I configure Magento with Varnish cache from the admin, the page doesn’t fully and it […]

Categories
Mastering Development

GRPC not setting some headers

I have this code to disable client caching for a GET API: headers := metadata.Pairs( "Cache-Control", "no-cache, no-store, must-revalidate", "Pragma", "no-cache", "Expires", "0", ) err := grpc.SetHeader(ctx, headers) When I curl -i the API, the response shows Cache-Control: no-cache, no-store, must-revalidate, but not the Pragma or Expires. I think I’m using the right way to […]

Categories
CMS Magento Mastering Development

Magento 2.3.5 klarna invalid form key

On my site https://www.nattklubbar.net/se I have installed latest klarna checkout along with magento 2.3.5 and I have a problem with invalid form key once placing the order. From Klarna logs response: Date: Sun, 16 Aug 2020 17:54:43 GMT Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive Set-Cookie: mage-messages=%5B%7B%22type%22%3A%22error%22%2C%22text%22%3A%22Invalid+Form+Key.+Please+refresh+the+page.%22%7D%5D; expires=Mon, 16-Aug-2021 17:54:43 GMT; Max-Age=31536000; path=/ Pragma: no-cache […]

Categories
Mastering Development

How to connect to CodeCommit repository in Cloudformation stack/pipeline

I am very new to Cloudformation and I have a (maybe) stupid question. Here goes. I want to describe my pipelines with cloudformation templates, which i commit to a repository (just for cloudformation templates). Then i create a pipeline, that deploys the templates, and with that create the pipelines for the different apps. This is […]

Categories
Mastering Development System & Network

Mirror command in NGINX and String matching in NGINX Config

I have enabled caching with NGINX and it works fine. Request that occurs multiple times is served directly from nginx cache and is not proxy passed to my server running. I have verified this. server { listen 443 ssl; server_name *.tme.com; add_header Strict-Transport-Security "max-age=0; includeSubDomains" always; ssl_certificate myce+5.pem; ssl_certificate_key myce+5-key.pem; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers […]

Categories
CMS Mastering Development Wordpress

Nginx reverse proxy on WordPress , Login not working

I have a WordPress site on Cpanel with litespeed on domain http://sub.domain1.com. I wanted to bring this behind a reverse proxy on https://domain2.com/sub/. here is my configuration: nginx: location /sub/ { proxy_pass http://sub.domain1.com/; proxy_set_header Host sub.domain1.com; proxy_redirect off; proxy_hide_header "Cache-Control"; add_header Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"; proxy_hide_header "Pragma"; add_header Pragma "no-cache"; expires -1; add_header […]

Categories
Mastering Development System & Network

Apache2 virtual host website redirecting users to router configuration page [closed]

I am running apache2 on Linux Mint Debian Edition 4.0. I am an apache newbie. I have setup a virtual host to point to my url. I am using dynu.com for virtual DNS redirection using the ddclient program to update dynu. When I try to bring up my url (markmhart.com) in any browser, instead of […]