Olav Grønås Gjerde

profile image
Full stack system architect with passion for Unix, Java, Python and databases.
Twitter @olavgg
10 months ago

Upgrade pgAdmin4 to a new version

If you followed my earlier blog How to install and configure pgAdmin4 for FreeBSD and with uWSGI you will see it was written for version 4.6 of pgAdmin4.

Upgrading pgAdmin4 isn't difficult, on fact you only need todo 3 steps to complete the upgrade:

First step, activate the virtual environment

$ source /opt/pgadmin/pgadm_env/bin/activate

Second step, upgrade pgAdmin4

(pgadm_env)$ sudo pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.8/pip/pgadmin4-4.8-py2.py3-none-any.whl

Third and last step, restart uwsgi

$ sudo service uwsgi restart

That's it, super simple!

12 months ago

How to set Grails or Spring Boot JSESSIONID Cookie SameSite Strict

Firefox recently displayed a warning that cookies without samesite attribute would stop working soon.

This can be done by creating a new bean ->

    import org.apache.tomcat.util.http.Rfc6265CookieProcessor;
    import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
    import org.springframework.boot.web.servlet.server.ServletWebServerFactory;

    @Bean
    ServletWebServerFactory servletContainer() {
        return new TomcatServletWebServerFactory() {
            @Override
            protected void postProcessContext(Context context) {
                Rfc6265CookieProcessor rfc6265Processor = new Rfc6265CookieProcessor();
                rfc6265Processor.setSameSiteCookies("Strict");
                context.setCookieProcessor(rfc6265Processor);
            }
        };
    }

For those of you who are new to beans in Grails, you can just copy this method into the default Application class in Grails. This example was done with Grails 4. If you use an older version where this is unsupported, you can also modify set cookie header with either Apache or Nginx.

View older blog posts ⇾