简体   繁体   中英

Nginx reverse proxy configuration for AWS web console

Is there a way to access AWS web console via nginx reverse proxy through my subdomain?

Here is the nginx configuration is have been using :

server {
  listen localhost:443 ssl;
  server_name aws1.subdomain.com;
  include snippets/proxy_ssl.conf;
  location / {
      proxy_pass              https://console.aws.amazon.com/;
      proxy_set_header        Host $host;

      proxy_http_version      1.1;
      proxy_set_header        Upgrade $http_upgrade;
      proxy_set_header        Connection "Upgrade";
      proxy_read_timeout      86400;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        X-Forwarded-Server $host;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

      proxy_redirect          off;
      proxy_hide_header X-Frame-Options;
  }
}

The above configuration throws:

NetworkError: 400 Bad Request

And shows amazon's default 400 bad request page when i try to access https://aws1.subdomain.com in my browser.

I have this working using the following lines in nginx.conf. You can also add lines for http auth as required depending on your config.

location = / { rewrite ^ /_plugin/kibana/ redirect; }
location / { 
  proxy_pass https://<es-domain-url>.es.amazonaws.com; 
  proxy_http_version 1.1; 
  proxy_set_header Authorization ""; 
  proxy_hide_header Authorization; 
  proxy_set_header X-Forwarded-Proto $scheme; 
} 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM