How to write Nginx reverse proxy?

I have nginx on Ubuntu

I would like to serve some pages as follows :

  • Case A : When a URL starts with ORDS (case insensitive), the following url should be served : localhost:8443/ords
  • Case B : Otherwise, the following url should be served : localhost:8443/something:

For example Case A :

and Case B

I tried the following configuration but it’s not working.

  • When I type I’m getting only Case B : localhost:8443/ords/something:ORDS (while I’m expecting Case A : localhost:8443/ords)

Can any one help please ?

    server {
            listen 443 ssl;
            location = /ords {
                            proxy_set_header Host $host;
                            proxy_pass https://localhost:8443/ords;                             
            location / {
                        proxy_set_header Host $host;
                        proxy_pass https://localhost:8443/ords/something:;