Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<!DOCTYPE html>
<title>iFrame Proxy</title>
<iframe src="http://localhost:3000?" width="800" height="400"></iframe>
const domain = (new URL(document.location)).searchParams.get('domain')
const element = document.querySelector('iframe')
element.src = `http://localhost:3000?domain=${domain}`
const { createServer } = require('http')
const { createReadStream } = require('fs')
const request = require('request')
createServer((req, res) => {
const url = new URL(req.url, `http://${}`)
const domain = url.searchParams.get('domain')
if (!domain) {
return createReadStream('./index.html').pipe(res)
const headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36'
request({ url: `http://${domain}`, headers }, (error, response, body) => {
if (error) return res.end()
for (const [name, value] of Object.entries(response.headers)) {
if (name === 'x-frame-options') continue
res.setHeader(name, value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment