From 11d7965ef7a2a1333c405f541370acba85bb5147 Mon Sep 17 00:00:00 2001 From: Kai Nguyen Date: Tue, 19 Dec 2023 01:20:05 +0700 Subject: [PATCH] fix --- nginx/default.conf | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/nginx/default.conf b/nginx/default.conf index 9a2ec64..438b49c 100644 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -104,21 +104,39 @@ server { proxy_pass http://portainer/api/websocket/; } - location /rabbitmq/ { - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Host $http_host; - proxy_intercept_errors on; - proxy_buffering off; - proxy_redirect off; + # location /rabbitmq/ { + # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + # proxy_set_header X-Forwarded-Proto $scheme; + # proxy_set_header Host $http_host; + # proxy_intercept_errors on; + # proxy_buffering off; + # proxy_redirect off; - proxy_pass http://rabbitmq/; + # proxy_pass http://rabbitmq/; + # } + + # location ~* /rabbitmq/(.*) { + # rewrite ^/rabbitmq/(.*)$ /$1 break; + # proxy_pass http://rabbitmq/; + # } + + location /rabbitmq/api/ { + rewrite ^ $request_uri; + rewrite ^/rabbitmq/api/(.*)/api/$1 break; + return 400; + proxy_pass http://rabbitmq$uri; } - location ~* /rabbitmq/(.*) { + location /rabbitmq { + rewrite ^/rabbitmq$ /rabbitmq/ permanent; rewrite ^/rabbitmq/(.*)$ /$1 break; - proxy_pass http://rabbitmq/; -} + proxy_pass http://rabbitmq; + proxy_buffering off; + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } } server {