app mvc behind proxy reverse
Francis Daly
francis at daoine.org
Thu Aug 6 16:25:41 UTC 2020
On Thu, Aug 06, 2020 at 09:48:55AM -0600, Rick Gutierrez wrote:
> El jue., 6 ago. 2020 a las 6:29, Francis Daly (<francis at daoine.org>) escribió:
Hi there,
> > Can you see what the html-or-javascript that tells the browser where to
> > POST the request, says about where to POST the request?
>
> The country file, is a javascript, performs the task, only that url
> that calls is where the controller is, that verifies if it edits or
> saves, and the proxy reverse does not interpret it that way because it
> is only a folder address, not a file address per that's it send a 404.
As I understand it, your nginx conf says (basically)
location / {
proxy_pass http://backend29;
}
so every request to nginx gets sent to the backend server. nginx does
not know or care about files or folders; it proxy_pass:es all requests.
So the 404 comes from the backend server, because the app causes the
browser to ask for /agregareditar and not for /pais/agregareditar.
> I am not a programmer, the country folder has several files.
>
> # Pais ls
>
> AgregarEditar.cshtml ListaPaises.cshtml
>
> Index.cshtml Pais.txt
>
>
> >
> > > any ideas?
> >
> > Maybe something like "location = /pais { return 301 /pais/; }" in
> > your nginx config will help, if the upstream server should do that but
> > does not?
>
> a little slower here, this would have to go down to the first
> location, so what you tell me:
>
> location = /pais { return 301 /pais/; }"
My guess is that your browser's first request is for "/pais",
and that returns something from the backend that says "ask for
agregareditar". And the browser correctly resolves "/pais" +
"agregareditar" to "/agregareditar". But that is not what you want.
My guess is that if your browser's first request is for "/pais/" (with
a / at the end), then what is returned from the backend will be the
same; but now the browser will resolve "/pais/" + "agregareditar" to
"/pais/agregareditar", which (hopefully) is what you want.
If that does work -- if you start by asking for "/pais/" and everything
works as you want it to -- then you can tell nginx to intercept the first
request for "/pais", and tell the browser to instead ask for "/pais/". And
then things might work.
You can tell nginx to do that one-interception by putting
location = /pais { return 301 /pais/; }
in the same file as your main config, just before the
location / {
line that you showed.
If your application does *not* work when you start by requesting "/pais/",
then this change to nginx will not fix things for you.
Right now, I see no evidence of a problem in the nginx config; only in
the backend application.
Maybe some evidence will appear, if there is still a problem.
Good luck with it,
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list