Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

329
Views
Nginx: el proxy inverso evita necesitar el número de puerto en la URL

Tengo una aplicación React que se ejecuta en https://localhost:3000 .

Tengo un dominio como https://example.com/some/path .

Cuando ingreso https://example.com/some/path en mi navegador, me gustaría redirigir a https://localhost:3000 . Entonces, la forma en que he visto que esto es posible es usando un proxy inverso y estoy tratando de configurar nginx para hacerlo.

Sin embargo, sigo enfrentando un problema que necesito incluir el número de puerto cuando voy a la URL completa, por ejemplo: https://example.com:3000/some/path .

¿Cómo evito que esto suceda? es decir, me gustaría simplemente ingresar https://example.com/some/path .

Mi archivo nginx conf se ve así:

 #user nobody; worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 443 ssl; server_name example.com; ssl_certificate cert.pem; ssl_certificate_key cert.key; location /some/path { return 301 $scheme://localhost:3000$request_uri; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } server { listen 3000 ssl; ssl_certificate cert.pem; ssl_certificate_key cert.key; server_name localhost; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains"; location / { proxy_pass https://localhost:3000; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } include servers/*; }

Y en mi archivo de hosts tengo la línea:

 127.0.0.1 example.com

Incluso si lo mantengo simple y solo tengo una sección de servidor con una ubicación como:

 location /some/path { proxy_pass https://localhost:3000; }

Eso funciona; sin embargo, al mirar la consola, los activos en sí no se cargan https://example.com/static/js/bundle.js cuando debe ser https://example.com:3000/static/js/bundle.js

Cualquier ayuda sería apreciada.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!