Nix and Mac OSX (High Sierra) FileVault

I was having problem when trying to enable FileVault, and found out later that because of Nix.  In order to enable it again, in terminal:

  1. List all uses from fdesetup with this command: sudo fdesetup list
  2. Remove user that starts with prefix nixbld from fdesetup: sudo fdesetup remove -user <nixbld_user>
  3. Enable FileVault: sudo fdesetup enable

If success, you should get prompt to enter your username (with admin permission) and password.  You can check encryption status with: sudo fdesetup status, and it should show you the current progress for turning on FileVault.

Not sure if need to add back nixbld user to fdesetup, but probably will find out later if there is problem.

Read More

Parse Server, Live Query and AWS LB

Today my partner has problem to create connection for Live Query to an AWS server deploy with Elastic Beanstalk, so I have to see why he is not able to start a websocket connection.

Currently, that Parse Server is running on a EC2 instance within a VPC, with an iptable routing request from AWS LB to Nginx.

My partner has tried couple things.  Switch from AWS classic LB to Application LB, and also enable stickiness on the request.  However, he was still stuck.

After Google like everyone do, I found that  “NGINX supports WebSocket by allowing a tunnel to be set up between a client and a backend server. For NGINX to send the Upgrade request from the client to the backend server, the Upgrade and Connection headers must be set explicitly

The setting is simple, I just added those header in Nginx configuration file, and Live Query Setting is working!

 

For more information how to upgrade request, this is the link:

https://www.nginx.com/blog/websocket-nginx/

Read More

Magento redirect route in Custom Module and Observer

I was asked to redirect all routes(except admin) in Magento 1.9.2 to a custom module‘s frontend.  With Observer pattern, it is very easy to achieve it.

In Magento, when the front page layout beginning to display, an event “controller_front_send_response_before” will occur, and we will subscribe to this event to trigger our function for redirection.

To subscribe to this event, add the following xml tags in etc/config.xml in our custom module directory in the global tag.

This is what I guess the meaning of this xml tag, but I may be wrong: Magento will use singleton method, get model observer, and call customRedirect() function.  (e.g. Mage::getSingleton(‘custom_module/observer’)->customRedirect() )

Since we will need a new model “Observer”, in our custom module directory, under Model folder, create a file call “Observer.php”.

In customeRedirect() function, my code will check if this is admin path, or custommodule path.  If pattern does not match, it will redirect to custommodule route.

if you want to redirect to HTTPS route, you will need to provide the second parameter in setRedirect function like this:

setRedirect(Mage::getUrl(“customemodule/index/index”, array(‘_forced_secure’ => true);

 

 

Read More