Index: /lang/perl/Moxy/trunk/assets/plugins/QRCode/panel.tt
===================================================================
--- /lang/perl/Moxy/trunk/assets/plugins/QRCode/panel.tt (revision 10012)
+++ /lang/perl/Moxy/trunk/assets/plugins/QRCode/panel.tt (revision 10133)
@@ -2,5 +2,5 @@
     function __MOXY_insert_image() {
         var qrdiv = document.getElementById('qrcode_placeholder');
-        var url = "http://" + location.host + "/" + encodeURIComponent("http://qrcode.moxy/[% current | uri %]");
+        var url = "http://" + location.host + "/?moxy_q=" + encodeURIComponent("http://qrcode.moxy/[% current | uri %]");
         qrdiv.innerHTML = "<img src='" + url + "' />";
         return false;
Index: /lang/perl/Moxy/trunk/t/Plugin-Server-rewrite.t
===================================================================
--- /lang/perl/Moxy/trunk/t/Plugin-Server-rewrite.t (revision 10041)
+++ /lang/perl/Moxy/trunk/t/Plugin-Server-rewrite.t (revision 10133)
@@ -29,5 +29,5 @@
 <a href="http://example.com/foo" title="foo">bar</a>
 --- expected
-<html><a href="http://localhost:9999/http%3A%2F%2Fexample.com%2Ffoo" title="foo">bar</a></html>
+<html><a href="http://localhost:9999/?moxy_q=http%3A%2F%2Fexample.com%2Ffoo" title="foo">bar</a></html>
 
 === relative
@@ -35,5 +35,5 @@
 <a href="/foo" title="foo">bar</a>
 --- expected
-<html><a href="http://localhost:9999/http%3A%2F%2Frelative.example.jp%2Ffoo" title="foo">bar</a></html>
+<html><a href="http://localhost:9999/?moxy_q=http%3A%2F%2Frelative.example.jp%2Ffoo" title="foo">bar</a></html>
 
 === upper case tag
@@ -41,5 +41,5 @@
 <A href="http://example.com/foo" title="foo">bar</A>
 --- expected
-<html><a href="http://localhost:9999/http%3A%2F%2Fexample.com%2Ffoo" title="foo">bar</a></html>
+<html><a href="http://localhost:9999/?moxy_q=http%3A%2F%2Fexample.com%2Ffoo" title="foo">bar</a></html>
 
 ===
@@ -47,5 +47,5 @@
 <a href="http://example.com/foo">bar</a>
 --- expected
-<html><a href="http://localhost:9999/http%3A%2F%2Fexample.com%2Ffoo">bar</a></html>
+<html><a href="http://localhost:9999/?moxy_q=http%3A%2F%2Fexample.com%2Ffoo">bar</a></html>
 
 === no href.
@@ -59,5 +59,11 @@
 <form method="post" action="http://example.com/search"><input type="submit" value="go" /></form>
 --- expected
-<html><form action="http://localhost:9999/http%3A%2F%2Fexample.com%2Fsearch" method="post"><input type="submit" value="go" /></form></html>
+<html><form action="http://localhost:9999/?moxy_q=http%3A%2F%2Fexample.com%2Fsearch" method="post"><input type="submit" value="go" /></form></html>
+
+=== form with query
+--- input
+<form method="post" action="http://example.com/search?k=foo"><input type="submit" value="go" /></form>
+--- expected
+<html><form action="http://localhost:9999/?moxy_q=http%3A%2F%2Fexample.com%2Fsearch" method="post"><input type="submit" value="go" /><input name="k" type="hidden" value="foo" /></form></html>
 
 === relative
@@ -65,5 +71,5 @@
 <form method="post" action="/search"><input type="submit" value="go" /></form>
 --- expected
-<html><form action="http://localhost:9999/http%3A%2F%2Frelative.example.jp%2Fsearch" method="post"><input type="submit" value="go" /></form></html>
+<html><form action="http://localhost:9999/?moxy_q=http%3A%2F%2Frelative.example.jp%2Fsearch" method="post"><input type="submit" value="go" /></form></html>
 
 === relative img
@@ -71,5 +77,5 @@
 <img src="/foo.jpg" />
 --- expected
-<html><img src="http://localhost:9999/http%3A%2F%2Frelative.example.jp%2Ffoo.jpg" /></html>
+<html><img src="http://localhost:9999/?moxy_q=http%3A%2F%2Frelative.example.jp%2Ffoo.jpg" /></html>
 
 === abs img
@@ -77,4 +83,4 @@
 <img src="http://example.com/bar.jpg">
 --- expected
-<html><img src="http://localhost:9999/http%3A%2F%2Fexample.com%2Fbar.jpg" /></html>
+<html><img src="http://localhost:9999/?moxy_q=http%3A%2F%2Fexample.com%2Fbar.jpg" /></html>
 
Index: /lang/perl/Moxy/trunk/lib/Moxy.pm
===================================================================
--- /lang/perl/Moxy/trunk/lib/Moxy.pm (revision 10110)
+++ /lang/perl/Moxy/trunk/lib/Moxy.pm (revision 10133)
@@ -110,9 +110,22 @@
         for my $node ( $tree->findnodes("//$tag") ) {
             if ( my $attr = $node->attr($attr_name) ) {
+                my $uri = URI->new($attr)->abs($base_url);
+                if ($tag eq 'form') {
+                    my $query = +{ $uri->query_form };
+                    while (my ($key, $val) = each %$query) {
+                        my $element = HTML::Element->new(
+                            'input',
+                            type  => 'hidden',
+                            name  => $key,
+                            value => $val
+                        );
+                        $node->push_content($element);
+                    }
+                    $uri->query_form({}); # strip query.
+                }
                 $node->attr(
-                    $attr_name => sprintf( qq{%s%s%s},
+                    $attr_name => sprintf( qq{%s?moxy_q=%s},
                         $base,
-                        ($base =~ m{/$} ? '' : '/'),
-                        uri_escape( URI->new($attr)->abs($base_url) ) )
+                        uri_escape( $uri ) )
                 );
             }
@@ -151,6 +164,6 @@
 </head>
 <body>
-    <form method="get" action="$base" onsubmit="location.href=location.href+encodeURIComponent(document.getElementById('moxy_url').value);return false;">
-        <input type="text" size="40" id="moxy_url" />
+    <form method="get" action="$base">
+        <input type="text" size="40" name="moxy_q" id="moxy_url" />
         <input type="submit" value="go" />
     </form>
@@ -181,6 +194,5 @@
         my $auth = decode_base64($1);
         $self->log(debug => "auth: $auth");
-        (my $url = $uri->path_query) =~ s!^/!!;
-        $url = uf_uristr(uri_unescape $url);
+        my $url = uf_uristr(+{$uri->query_form()}->{moxy_q});
         $self->log(info => "REQUEST $auth, @{[ $url || '' ]}");
         my $response = $self->_make_response(
@@ -231,5 +243,5 @@
                 $location->port($uri->port);
             }
-            $res->header( 'Location' => $base_url . '/' . uri_escape( $location ) );
+            $res->header( 'Location' => $base_url . '/?moxy_q=' . uri_escape( $location ) );
             $self->log(debug => "redirect to " . $res->header('Location'));
         } else {
Index: /lang/perl/Moxy/trunk/lib/Moxy/Plugin/LocationBar.pm
===================================================================
--- /lang/perl/Moxy/trunk/lib/Moxy/Plugin/LocationBar.pm (revision 10020)
+++ /lang/perl/Moxy/trunk/lib/Moxy/Plugin/LocationBar.pm (revision 10133)
@@ -17,9 +17,6 @@
 
     return sprintf(<<"...", encode_entities($current_url));
-    <script>
-        var moxy_base = location.protocol.replace(':', '') + '://' + location.host;
-    </script>
-    <form method="get" onsubmit="location.href=moxy_base +'/'+encodeURIComponent(document.getElementById('moxy_url').value);return false;">
-        <input type="text" value="\%s" size="40" id="moxy_url" />
+    <form method="get">
+        <input type="text" value="\%s" size="40" name="moxy_q" />
         <input type="submit" value="go" />
     </form>
