Redirect a subdirectory to another server while keeping the domain name

I have a working website under the domain domain.tld. We want to add an external service to it in such way we have domain.tld/blog but install it on another server so we don’t touch anything on this old (but working) one.

Is it possible to do on

My suggestion would be having a reverse proxy app.

Put your domain on the reverse proxy app and let it decide where to route to. You could reverse proxy using any generic reverse proxy such as minx that will redo the entire request on the other app and serve it to your end user or your could let your reverse proxy be very simple and use fly-replay so our proxy will take care of it:

Hi @lubien

Thanks for the reply. Do you have some guide or example on how to set up a reverse proxy app on Fly? I’m totally new to this and would appreciate any help.


Below is a sample that may help you get started. It also demonstrates the common problem that you will see: links to scripts, stylesheets, images and even other pages need to either be aware of the fact that they are running under a subdirectory or be relative URLs. If you are the author of the app, this shouldn’t be a big problem, otherwise you may be able to get what you need using Module ngx_http_sub_module.

# syntax = docker/dockerfile:1

FROM nginx:latest

COPY <<-"EOF" usr/share/nginx/html/index.html
<!DOCTYPE html>
    <title>Hello World!</title>
    <h1>Hello World!</h1>

COPY <<-"EOF" /etc/nginx/conf.d/default.conf
server {
  listen 8080;
  listen [::]:8080;
  server_name localhost;

  location / {
    root /usr/share/nginx/html;
    index index.html index.htm;

  location /fly {
    proxy_ssl_server_name on;

  error_page 500 502 503 504 /50x.html;
  location = /50x.html {
    root /usr/share/nginx/html;


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.