Getting access to the request body to proxy to a development backend
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- javascript, node.js
Research direction
Start by reviewing the server's onRequest hook and the http-proxy-middleware example included in the issue. Determine how request data is currently exposed and define completion as enabling a development-backend proxy to forward form data for methods such as POST.
Written by the indexing model from the issue text.
Description
Thanks for the great work on the 11ty ecosystem! I would like to incorporate this plugin and remove @11ty/eleventy-server-browsersync, but I have a use case similar to https://github.com/11ty/eleventy-dev-server/issues/9. Below I show my use case with the browsersync plugin and http-proxy-middleware to proxy the entire request to a development backend. I believe this library could replicate the behavior below if onRequest passed the request or request body so that I could forward the request with the form data for methods such as POST (11ty creates HTML forms that post data)
What are your thoughts on this for your library?
const apiProxy = createProxyMiddleware({
pathFilter: opts.intercept,
target: opts.backend,
changeOrigin: true,
logger: console,
on: {
proxyReq: function (proxyReq, req) {
proxyReq.setHeader("Authorization", opts.authorization || "");
proxyReq.setHeader(
"Referer",
req.headers.referer?.replace(
"http://localhost:8080",
`http://${process.env.HOSTNAME}:8080`,
) || "",
);
},
},
});
config.setServerOptions({
module: "@11ty/eleventy-server-browsersync",
port: 8080,
open: false,
notify: false,
ui: false,
ghostMode: false,
snippet: true,
middleware: [apiProxy],
});
- Dominant language
- JavaScript
- Stars
- 109
- Forks
- 19
- Avg merge
- 6d 3h
- Merged PRs (30d)
- 2
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from 11ty/dev-server
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
11ty/dev-server#95 ·
-
needs-votes
Difficulty 4/5 3-5 days Newbie friendliness 35/100
11ty/dev-server#113 · 2 comments ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
11ty/dev-server#86 · 1 comment ·
-
enhancement needs-votes
Difficulty 3/5 1-2 days Newbie friendliness 45/100
11ty/dev-server#82 · 4 comments ·
-
enhancement needs-votes
Difficulty 3/5 1-2 days Newbie friendliness 45/100
11ty/dev-server#53 · 3 comments · 2 reactions ·
Similar issues
-
accepting PR Content:HTML
Difficulty 1/5 Under an hour Newbie friendliness 88/100
mdn/content#45988 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
paperclipai/paperclip#15253 ·
Maintainers usually reply within 1 day
-
needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
solana-foundation/solana-com#2245 ·
Maintainers usually reply within 1 day