How to Setup your own Medium custom domain

cuongmx
2 min readJan 13, 2021

--

As you know, Medium have stopped support setup custom domain for Medium users for years. This topic will help you a trick to bypass the limit.

Theory

Use reversed proxy to forward request from custom domain to Medium page

Very basically, we can use any reversed proxy to forward any request from custom domain to Medium page destination.

Implementation

I’m a big fan of Heroku, so I prefer solution which can deploy to Heroku. So, I decided to write an Flask application to work as reversed proxy.

A very simple code in python to run a reversed proxy

In fact, I have a small problem when run reversed proxy to Medium page. In the Medium features, it run like mobile application, this make there are many javascript event installed on the page and the page will be 500 error if use click to read on reversed proxy page. Fortunately, I found a solution to remove the listener event. And now, pages after reversed seem work smoothly.

Installation

For the installation, please follow the guide on my repo https://github.com/cuongmx/MediumProxy

Basically, there 3 steps:

  • Setup application to Heroku
  • Customize Heroku domain
  • Add domain to Cloudflare if you need https

Demo

In my demo, I have setup my domain https://m.cuong.mx point to my Medium https://cuongmx.medium.com

--

--

cuongmx

I'm a developer working in cyber security. My regularly IDE is MS Word.