Additionnal configuration when setting up a reverse-proxy in front of a UNS.network node

You may set up a reverse-proxy such as Apache or Nginx in front of your UNS.network node, in order, for example, to offer a TLS connection to your users.

This is how is configured our main Forger1 API server in order to offer HTTPS connection to our users.

When doing such a configuration, you will need to allow reverse-proxing of %2f URL-espaced char / because Unikname and uns.network tools are using it on the /uniks/{id}/properties/{propertyKey} API.

Here is the configuration you have to add to your Apache instance:

<VirtualHost *:443>

    ...

    ProxyPreserveHost On
    ProxyRequests Off

    # Allow URL such as /api/v2/uniks/3b7/properties/Badges%2FSecurity%2FSecondPassphrase
    # Used with 'ProxyPass ... nocanon' below
    AllowEncodedSlashes NoDecode

    ProxyPass / http://<your_node_IP>:<port>/ nocanon
    ProxyPassReverse / http://<your_node_IP>:<port>/

    ...

</VirtualHost>

Notice the AllowEncodedSlashes and nocanon flags.

If you don’t do this additional configuration, you will get HTTP 404 errors on your reverse-proxy.

Anyone to describe us the same configuration for Nginx?

2 Likes

I will think about this if I set up a reverse-proxy in front of my node.
So nice, thank you.