diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..748ffce928 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,33 @@ +name: ci + +on: + push: + branches: + - 'master' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: nyamisty/tor2web:latest diff --git a/config/nginx.conf.template b/config/nginx.conf.template index 9ae7364078..ac40e3c095 100644 --- a/config/nginx.conf.template +++ b/config/nginx.conf.template @@ -58,6 +58,18 @@ http { end } + rewrite_by_lua_block { + local hdrs = ngx.req.get_headers() + if hdrs['Referer'] then + local newRef = ngx.re.gsub( + hdrs['Referer'], + '//([0-9a-z.-]+\\.)?([2-7a-z]{56})\\.${TOR2WEB_HOST}', + '//$1$2.onion' + ) + ngx.req.set_header("Referer", newRef) + end + } + header_filter_by_lua_block { if not ngx.header['Onion-Location'] then ngx.header['Onion-Location'] =