Boa tarde, estou usando um servidor no EC2 da aws, com SO amaxon linux 2 para montar um ambiente de homologação, nesses servidor tenho um nginx 1.24 onde configurei um site estatico feito em react, no location /, e no location /api tenho um proxy reverso apontando para um tomcat server, que tem uma api java 8 com springboot
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
# add_header 'Access-Control-Allow-Origin' '*' always;
# add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
# add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,Us er-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type' always;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
types_hash_max_size 4096;
tcp_nodelay on;
client_max_body_size 50M;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
# listen 80 default_server;
# listen [::]:80 default_server;
server_name ndex-set.hml.brisausa.com;
# root /usr/share/nginx/html/ndex-set-web;
# Load configuration files for the default server block.
# include /etc/nginx/default.d/*.conf;
ssl_certificate "/home/ec2-user/front-cert-ndex-set/fullchain1.pem";
ssl_certificate_key "/home/ec2-user/front-cert-ndex-set/privkey1.pem";
add_header Strict-Transport-Security "max-age=31536000";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers PROFILE=SYSTEM;
ssl_prefer_server_ciphers on;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
error_page 404 /404.html;
location = /404.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
location /api { #
proxy_pass http://localhost:8080/NDEX-SET-1.0.0;
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-Proto $scheme;
}
# location /image {
# root /usr/share/nginx/html/ezyaccess_files/;
# }
location / {
root /usr/share/nginx/html/ndex-set-web;
try_files $uri $uri/ /index.html;
}
}
}
esse é arquivo de configuração do nginx. Quando faço a requisição na api pelo postman, ou loccal na minha maquina, a requisição retorna 200, mas quando uso o front que está no próprio nginx, retorna 403. Alguem poderia me ajudar?