I have an application on an EC2 instance behind NGINX. NGINX serves the client as follows
https://localhost:443/org/consumer/consumer-app
My app in the backend only understands
http://localhost:8080/consumer/consumer-app
Both NGINX and app are on the same EC2 instance. I want a way to eliminate the /org/ before I pass the request to the upstream server. I tried rewrite directive but couldn't get it to work. What's the best way to do it?
Also, I want the /org/ reintroduced back by NGINX when responding back to the client.
Any help offered would be greatly appreciated.
Thanks
Related
I have setup a nginx proxy to pass https url to internal http neo4j web. I can reach the neo4j login page without any issue, but I am forced to use the neo4j+s/bolt+s interface.
Just wondering how I can configure nginx to remove any ssl related info via proxypass module, in order to login in neo4j with ws, no wss?
Thanks,
Chance
I managed to get rid of wss by adding another nginx proxy to set the https url as upstream server in location.proxy_pass. It won't show wss/neo4j+s/bolt+s any more once you visit the web by the http url. Hopefully it will help for anyone has the similar issue as me.
I use angular for ui with nginx as webserver.
Since we use self-signed certificate, when I issue https request from ui, I get net::ERR_CERT_AUTHORITY_INVALID.
Is there anywhere in config of nginx to just bypass this error and let me in?
Any input is greatly appreciated. Thank you very much for your time.
I'm trying to deploy a Sanic app next to Nginx. I want Nginx to handle:
File serving (my SPA and other assets)
Certbot/letsencrypt ssl (can do without)
And I want Sanic to handle my API endpoints.
I know how to handle each separately. However, I don't know how to make them run next to each other. As far as I know, you can't have two services listening on the same TCP port. If that's the case, should I just make Nginx act as a reverse proxy to Sanic? If so, how would you go about it?
Any guidance would be appreciated.
This is my preferred way to run Sanic, behind nginx as you described. Then just proxy to Sanic which is listening on some other port.
server {
...
location /api/ {
proxy_pass http://sanic-app:1234/;
}
}
Okay, so I know there is a lot of questions about Nginx Reverse Proxy but I don't understand any of the answers. I read the documentation on Nginx's website and I kind of get it but need some help.
So here is what I want.
Visitor ---> Nginx Reverse Proxy ---> Nginx Server (Website)
I know that you can get the reverse proxy to listen to a remote server, but I can't find the configuration files that I want. I also want to show a static html page when passing through the Nginx Reverse Proxy. So like a page that says "Hosted by this company", like Cloudflare does. I asked someone and they told me if I put the html file on the reverse proxy server then it'll show up when the visitor goes through the server, but I don't understand that concept, how do I get that static html to show up? And what will be the correct configuration be for this? I imagine it'll be different from a normal remote server configuration.
Thanks in advance!
In Nginx reverse proxy configuration it is possible to make some urls to be served from reverse proxy itself without going to source server.
Take a look at the following article: https://www.cevapsepeti.com/how-to-setup-nginx-as-reverse-proxy-for-wordpress/
In this article you can see in virtual.conf lines 51-55 that error_pages are served directly from reverse proxy, while other assets are fetched from source server first. Cloudflare employs the same concept. I hope this helps.
I'm trying to come up with a solution where I can do the follow:
In my scenario there are 2 servers.
API1: Nginx + API Website
API2: Nginx + Staging Website
In order to check new version of API via mobileapp, I want to set my phone to use a proxy server (Should be API2), and only when the dest URL is https://api.test.com it will redirect it internally to localhost:6000.
Any ideas of how it can be done? I know Nginx does not support SSL Proxing, but maybe I'm wrong.
Thanks
Well,
Eventually I was able to accomplish that by using Apache Traffic Server which has been configured as a forward proxy while doing some map rules to redirect traffic from https to localhost:443/
But, I will be happy to hear some more ideas.
Thanks