LMSouq
server-admin Open

How do I rewrite URLs in a proxy response in NGINX

IA
IanG
1 month ago
3 views
Problem Description
I'm used to using Apache with mod_proxy_html, and am trying to achieve something similar with NGINX. The specific use case is that I have an admin UI running in Tomcat on port 8080 on a server at the root context: http://localhost:8080/ I need to surface this on port 80, but I have other contexts on the NGINX server running on this host, so want to try and access this at: http://localhost:80/admin/ I was hoping that the following super simple server block would do it, but it doesn't quite: server { listen 80; server_name screenly.local.akana.com; location /admin/ { proxy_pass http://localhost:8080/; } } The problem is that the returned content (html) contains URLs to scripts and style info that is all accessed at the root context, so I need to get these URLs rewritten to start with /admin/ instead of /. How do I do this in NGINX?

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base