# Korero Maori Proxy Setup

1. Find your ASR API key and run the setup script.

    ```sh
    > ./setup.sh
    ```

2. Edit the HTML content of the `unauthorised` page so that the button redirects to your preferred location.

    ```sh
    nano src/main/webapp/webContent/unauthorised.html
    ```

3. Compile and install the WAR file.

    ```sh
    > ant install
    ```

4. Update the apache2 config with the relevant `ProxyPass` rules

    ```sh
    > sudo nano /etc/apache2/sites-enabled/000-default-le-ssl.conf
    > sudo nano /etc/apache2/sites-enabled/000-default.conf
    > sudo /etc/init.d/apache2 reload
    
    // ADD THE FOLLOWING
    ProxyPass /gs3-koreromaori http://localhost:8383/gs3-koreromaori
    ProxyPassReverse /gs3-koreromaori http://localhost:8383/gs3-koreromaori
    ```

5. If `403 Forbidden` errors are observed, update the CORS filter in `web.xml` to include your root domains, and re-install.

    ```sh
    > nano src/main/webapp/WEB-INF/web.xml

    <filter>
        <filter-name>CorsFilter</filter-name>
        <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
        <init-param>
            <param-name>cors.allowed.origins</param-name>
            -- <param-value>http://localhost:8080</param-value> <!-- Separate values by a comma -->
            ++ <param-value>http://localhost:8080,http://atea.space,https://atea.space</param-value>
        </init-param>
    </filter>
    ```
