Добрый день!
В компании развернут проприетарный bitbucket. Слушает порт 7990. На нем же локально поднят nginx на 80 порту, дабы проксировать запросы и не указывать порт в URL:
server {
listen 80;
server_name bitbucket.company.ru bitbucket; location / {
proxy_pass http://127.0.0.1:7990;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
port_in_redirect off;
proxy_connect_timeout 600;
client_max_body_size 100m;
error_log /usr/local/nginx/logs/stash.error.log;
access_log /usr/local/nginx/logs/stash.access.log;
}
}
Все работает.
Снаружи доступ организован также через nginx по https:
server {
listen 80;
server_name bitbucket.сompany.ru;
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
return 301 https://bitbucket.company.ru$request_uri;
}
server {
server_name bitbucket.company.ru;
listen 443 ssl;
#SSL
ssl on;
ssl_session_timeout 24h;
ssl_certificate /etc/letsencrypt/live/bitbucket.company.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/bitbucket.company.ru/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/bitbucket.company.ru/chain.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;
ssl_session_cache shared:SSL:10m;
add_header Strict-Transport-Security "max-age=31536000;";
resolver 8.8.8.8 8.8.4.4 valid=300s;
ssl_stapling on;
ssl_stapling_verify on;
resolver_timeout 10s;
ssl_dhparam /etc/pki/nginx/dhparam.pem;
location / {
proxy_pass http://12.17.1.136:7990;
proxy_set_header Host $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-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_redirect off;
proxy_send_timeout 100;
proxy_read_timeout 100;
proxy_buffers 4 32k;
proxy_connect_timeout 600;
client_max_body_size 100m;
port_in_redirect off;
error_log /var/log/nginx/bitbucket.company.ru.error.log;
access_log /var/log/nginx/bitbucket.company.ru.access.log;
}
}
На любой POST запрос - 403 Forbidden:
213.87.136.158 - - [24/Aug/2016:10:50:25 +0300] "POST /rest/api/latest/projects/ATSB/repos/autotransact/pull-requests/5/comments?version=&avatarSize=64&markup=true HTTP/1.1" 403 54 "https://bitbucket.company.ru/projects/ATSB/repos/autotransac... "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36"
104.45.18.178 - - [24/Aug/2016:10:51:01 +0300] "GET /rest/api/latest/projects/ATSB/repos/autotransact/pull-requests/5/comments?version=&avatarSize=64&markup=true HTTP/1.1" 401 163 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) SkypeUriPreview Preview/0.5"213.87.136.158 - - [24/Aug/2016:10:50:25 +0300] "POST /rest/api/latest/projects/ATSB/repos/autotransact/pull-requests/5/comments?version=&avatarSize=64&markup=true HTTP/1.1" 403 54 "https://bitbucket.company.ru/projects/ATSB/repos/autotransac... "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36"
104.45.18.178 - - [24/Aug/2016:10:51:01 +0300] "GET /rest/api/latest/projects/ATSB/repos/autotransact/pull-requests/5/comments?version=&avatarSize=64&markup=true HTTP/1.1" 401 163 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) SkypeUriPreview Preview/0.5"
На разницу IP в логах прошу не обращать внимания - разные клиенты. Просто, нужно было показать, что GET запросы отрабатывает нормально, POST - 403.