0

It's simple set up.

Three docker containers in same network.

  1. ReactJs - production build on nginx server
  2. Spring Boot
  3. Mysql

GET, POST request works like a charm but when i try to use PATCH request i ends up with

Invalid CORS request

2021/09/01 23:17:27 [notice] 31#31: *5 "/api/(.*)" matches "/api/task/assign/5/S01", client: 172.18.0.1, server: localhost, request: "PATCH /api/task/assign/5/S01 HTTP/1.1", host: "localhost", referrer: "http://localhost/operator/controlpanel"
2021/09/01 23:17:27 [notice] 31#31: *5 rewritten data: "/task/assign/5/S01", args: "", client: 172.18.0.1, server: localhost, request: "PATCH /api/task/assign/5/S01 HTTP/1.1", host: "localhost", referrer: "http://localhost/operator/controlpanel"
172.18.0.1 - - [01/Sep/2021:23:17:27 +0000] "PATCH /api/task/assign/5/S01 HTTP/1.1" 403 31 "http://localhost/operator/controlpanel" "Mozilla/5.0 (Windows NT xx; Win64; x64; rv:xx) Gecko/20100101 Firefox/91.0" "-"

My nginx configuration

server {
  listen          80;
  server_name     localhost;
  expires -1;
  etag off;
  proxy_no_cache 1;
  rewrite_log on;

 location / {
   root /usr/share/nginx/html;
   try_files $uri /index.html;
 }

  location /api {
        rewrite /api/(.*) /$1  break;
        proxy_pass http://app:8080;
        proxy_pass_request_headers on;
        default_type  application/json;
  }
}

On spring boot end i do not received any request info so i assume it has been blocked before sending it to spring server.

Any idea what i'm doing wrong?

Lucas
  • 1
  • 2

0 Answers0