Skip to content

Commit

Permalink
feat: production release
Browse files Browse the repository at this point in the history
  • Loading branch information
samialdury committed Mar 2, 2022
1 parent 0b4e34d commit 7bfa74f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ LOGGER_LEVEL=
# Smartlook services (defaults to EU region)
MANAGER_HOST=
WEB_SDK_WRITER_HOST=
ASSETS_PROXY_HOST=
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Smartlook Relay Proxy
> ⚠️ Project is still under development, please wait for official Smartlook announcement before deploying it in your application.

This service relays HTTP requests from your domain/subdomain to
Smartlook's recording domains, allowing you to bypass Ad blockers used
Expand All @@ -14,6 +13,7 @@ by your visitors.
| `LOGGER_LEVEL` | `string` | `'info'` | One of `trace`, `debug`, `info`, `warn`, `error`, `fatal`, `silent` |
| `MANAGER_HOST` | `string` | `'https://manager.eu.smartlook.cloud'` | Smartlook Manager host |
| `WEB_SDK_WRITER_HOST` | `string` | `'https://web-writer.eu.smartlook.cloud'` | Smartlook Web Writer host |
| `ASSETS_PROXY_HOST` | `string` | `'https://assets-proxy.smartlook.cloud'` | Smartlook Assets Proxy host |

## Installation and deployment

Expand All @@ -27,6 +27,7 @@ docker run --name="smartlook-relay-proxy" -d \
-e LOGGER_LEVEL=<level> \ # optional
-e MANAGER_HOST=<host> \ # optional
-e WEB_SDK_WRITER_HOST=<host> \ # optional
-e ASSETS_PROXY_HOST=<host> \ # optional
-p <port>:8000 \
smartlook/relay-proxy:latest
```
Expand Down
12 changes: 0 additions & 12 deletions src/proxy/handler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { IncomingMessage, ServerResponse } from 'http'

import { config } from '../config'
import { logger } from '../logger'

import { ROUTES } from './routes'
Expand All @@ -26,17 +25,6 @@ export const handler = async (
logger.trace({ url: req.url, headers: req.headers }, 'Request')

for (const route of ROUTES) {
// Legacy routes, will be removed
if (
req.url !== '/recorder.js' &&
(req.url.startsWith('/record') || req.url.startsWith('/v2/record'))
) {
const targetHost = config.get('proxy.hosts.webSdkWriter')
const url = `${targetHost}${req.url}`
await pipeResponse(targetHost, url, req, res)
return
}

if (!req.url.startsWith(route.prefix)) {
continue
}
Expand Down

0 comments on commit 7bfa74f

Please sign in to comment.