A proxy on your own server for the requests of a web page, since most servers don't let a page of another site read their answers.
The proxy fetches any public URL for whoever can reach it, so put it behind your login. Its answers come from other sites but have the origin of yours, so it refuses to be opened as a page, and no answer runs scripts when a browser opens it anyway.
A proxy on your own server for the requests of a web page, since most servers don't let a page of another site read their answers. The proxy fetches any public URL for whoever can reach it, so put it behind your login. Its answers come from other sites but have the origin of yours, so it refuses to be opened as a page, and no answer runs scripts when a browser opens it anyway.
The options of the proxy, which its own options replace one by one:
Each request also has the :timeout-seconds of the options, if any. The page's own cookies and credentials never go on, unless :forward names them.
The options of the proxy, which its own options replace one by one: - :allow-pred, the URLs that it fetches, those on the public internet - :send, the function that sends a request, http/send! - :forward, the request headers that go on to the other site - :expose, the response headers that come back to the page - :user-agent, the User-Agent of each request - :max-bytes, the most that a body can hold, 32 MB, since the proxy holds each body in memory Each request also has the :timeout-seconds of the options, if any. The page's own cookies and credentials never go on, unless :forward names them.
(error-response e)The Ring response for e, the exception of the :send of the proxy, with
the Proxy-Status of RFC 9209, from which the page makes the same
exception again.
The Ring response for `e`, the exception of the :send of the proxy, with the Proxy-Status of RFC 9209, from which the page makes the same exception again.
(handler)(handler opts)A Ring handler that sends each GET and HEAD request on to the URL of
its url parameter, with opts over defaults, and answers with what
came back.
Mount it with any router, e.g. Pedestal, ring-jetty or http-kit, behind your login.
A Ring handler that sends each GET and HEAD request on to the URL of its url parameter, with `opts` over defaults, and answers with what came back. Mount it with any router, e.g. Pedestal, ring-jetty or http-kit, behind your login.
(proxied base {:keys [url as] :as request})The request sent through the proxy at base: to base, with the URL
of the request as the url parameter, and without its :allow-pred, which the
proxy applies itself.
The `request` sent through the proxy at `base`: to `base`, with the URL of the request as the url parameter, and without its :allow-pred, which the proxy applies itself.
(refusal {:keys [request-method] :as ring-request})The Ring response that refuses ring-request, or nil when the proxy
sends it on. The proxy refuses:
The Ring response that refuses `ring-request`, or nil when the proxy sends it on. The proxy refuses: - a method other than GET and HEAD - a request that it sent itself, as its Via tells - a page that opens it as a document, or a page of another site, as the Sec-Fetch-Mode and Sec-Fetch-Site of the browser tell - a request without an http or https URL as its url parameter
(ring-response response)(ring-response {:keys [status url permanent-url headers body] :as response}
{:keys [expose] :or {expose (:expose defaults)} :as opts})The Ring response that gives the page the response of its request,
with the headers of the :expose of opts, or else of defaults.
A text body goes as UTF-8, since a page reads the answers of fetch in it. The URL that answered, after redirects, is the Content-Location (RFC 9110, section 8.7). The URL that permanent redirects led to is the Wary-Fetch-Permanent-Location.
The Ring response that gives the page the `response` of its request, with the headers of the :expose of `opts`, or else of defaults. A text body goes as UTF-8, since a page reads the answers of fetch in it. The URL that answered, after redirects, is the Content-Location (RFC 9110, section 8.7). The URL that permanent redirects led to is the Wary-Fetch-Permanent-Location.
(sender base)(sender base {:keys [send] :or {send http/send!} :as opts})A function to give as :send, which sends each request through the
proxy at base, with opts, and gives what a direct request would.
The base is the URL of the route of the proxy, e.g. /proxy in a page.
Each request goes with the :send of opts, http/send! by default. A
request whose URL isn't http or https, e.g. a WebSocket that a page opens
by itself, goes to that :send as it is.
A function to give as :send, which sends each request through the proxy at `base`, with `opts`, and gives what a direct request would. The `base` is the URL of the route of the proxy, e.g. /proxy in a page. Each request goes with the :send of `opts`, http/send! by default. A request whose URL isn't http or https, e.g. a WebSocket that a page opens by itself, goes to that :send as it is.
(unproxied request {:keys [headers] :as response})The response of the proxy to request, as a direct request would
give it.
The response has the :url that answered, after redirects, and the :permanent-url that permanent redirects led to. When the proxy failed to send the request, this throws the exception that a direct request would have thrown, with the same :type.
The `response` of the proxy to `request`, as a direct request would give it. The response has the :url that answered, after redirects, and the :permanent-url that permanent redirects led to. When the proxy failed to send the request, this throws the exception that a direct request would have thrown, with the same :type.
(upstream-request ring-request)(upstream-request {:keys [request-method] :as ring-request} opts)The request that the proxy sends for ring-request, with opts over
defaults, or nil when the url parameter names no http or https URL.
The request has the headers of the :forward of opts, the Via of the
proxy, and the range of the Range header, so that no more is read than
it asks for. Its body is bytes when the as parameter is bytes, and else
text.
The request that the proxy sends for `ring-request`, with `opts` over defaults, or nil when the url parameter names no http or https URL. The request has the headers of the :forward of `opts`, the Via of the proxy, and the range of the Range header, so that no more is read than it asks for. Its body is bytes when the as parameter is bytes, and else text.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |