0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

プロキシサーバとは

Posted at

プロキシサーバとは

アプリケーションゲートウェイ型ファイアフォールのうち、特にhttpを扱うものをプロキシサーバと呼ぶことがあります。プロキシ(proxy)とは「代理」という意味で、クライアントからインターネット上のwebサーバへのアクセス要求を中継するのがプロキシサーバです。フォワードプロキシとも言います。
プロキシサーバは、Webページへのアクセス時に内容をキャッシュしておき、次にそのwebサーバへのアクセス要求があった場合、インターネットに問い合わせることなく
キャッシュの内容を返信します。ただし、キャッシュできるのは内容に変化のない静的なコンテンツに限られます
インターネットからのアクセスをwebサーバに中継するものをリバースプロキシサーバと言います。

mod_proxy

This module implements a proxy/gateway for Apache. It implements proxying capability for AJP13 (Apache JServe Protocol version 1.3), FTP, CONNECT (for SSL), HTTP/0.9, HTTP/1.0, and HTTP/1.1. The module can be configured to connect to other proxy modules for these and other protocols.

Apache's proxy features are divided into several modules in addition to mod_proxy: mod_proxy_http, mod_proxy_ftp, mod_proxy_ajp, mod_proxy_balancer, and mod_proxy_connect. Thus, if you want to use one or more of the particular proxy functions, load mod_proxy and the appropriate module(s) into the server (either statically at compile-time or dynamically via the LoadModule directive).

mod_proxy and related modules implement a proxy/gateway for Apache HTTP Server, supporting a number of popular protocols as well as several different load balancing algorithms. Third-party modules can add support for additional protocols and load balancing algorithms.
A set of modules must be loaded into the server to provide the necessary features. These modules can be included statically at build time or dynamically via the LoadModule directive). The set must include:

apache用のプロキシ/ゲートウェイ機能が実装される。
proxy機能が他のモジュールに分割されてる。
proxy機能を使うにはmod_proxyと適切なモジュールが必要らしい。

mod_proxy_http

This module requires the service of mod_proxy. It provides the features used for proxying HTTP and HTTPS requests. mod_proxy_http supports HTTP/0.9, HTTP/1.0 and HTTP/1.1.

https://httpd.apache.org/docs/current/en/mod/mod_proxy_http.html#:~:text=This%20module%20requires%20the%20service%20of%20mod_proxy.%20It%20provides%20the%20features%20used%20for%20proxying%20HTTP%20and%20HTTPS%20requests.%20mod_proxy_http%20supports%20HTTP/0.9%2C%20HTTP/1.0%20and%20HTTP/1.1.

httpのサポートするために必要。

proxypass

<Location "/mirror/foo/">
   ProxyPass "http://backend.example.com/"
</Location>

will cause a local request for http://example.com/mirror/foo/bar to be internally converted into a proxy request to http://backend.example.com/bar.

https://httpd.apache.org/docs/current/en/mod/mod_proxy.html#proxypass:~:text=%3CLocation%20%22/mirror,com/bar.

ProxyPassReverse

For example, suppose the local server has address http://example.com/; then

ProxyPass         "/mirror/foo/" "http://backend.example.com/"
ProxyPassReverse  "/mirror/foo/" "http://backend.example.com/"
ProxyPassReverseCookieDomain  "backend.example.com"  >"public.example.com"
ProxyPassReverseCookiePath  "/"  "/mirror/foo/"

will not only cause a local request for the
http://example.com/mirror/foo/bar to be internally converted into a proxy request to http://backend.example.com/bar (the functionality which ProxyPass provides here). It also takes care of redirects which the server backend.example.com sends when redirecting http://backend.example.com/bar to http://backend.example.com/quux . Apache httpd adjusts this to http://example.com/mirror/foo/quux before forwarding the HTTP redirect response to the client. Note that the hostname used for constructing the URL is chosen in respect to the setting of the UseCanonicalName directive.

感想

今のやり方でしかweb三層を実装できなかった。
他の方法もあるかもしれない。
英語を無理やり読んだ。
間違っているから調べてください。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?