Skip to content

Commit 1534ac9

Browse files
authored
Merge pull request #409 from thefrontside/cl/proxy-form-actions
🐛 re-write form actions to be properly based
2 parents 20585d2 + 1372b37 commit 1534ac9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

routes/proxy-route.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export function proxyRoute(options: ProxyRouteOptions): HTTPMiddleware {
6060
let body = yield* call(() => response.text());
6161
let tree = fromHtml(body);
6262

63-
let elements = selectAll('[href^="/"],[src^="/"]', tree);
63+
let elements = selectAll('[href^="/"],[src^="/"],form[action]', tree);
6464

6565
for (let element of elements) {
6666
let properties = element.properties!;
@@ -73,6 +73,11 @@ export function proxyRoute(options: ProxyRouteOptions): HTTPMiddleware {
7373
if (properties.src) {
7474
properties.src = posixNormalize(`${base.pathname}${properties.src}`);
7575
}
76+
if (properties.action) {
77+
properties.action = posixNormalize(
78+
`${base.pathname}${properties.action}`,
79+
);
80+
}
7681
}
7782
let headers: Record<string, string> = {};
7883
for (let [key, value] of response.headers.entries()) {

0 commit comments

Comments
 (0)