proxy_pass works on main page but not other pages

Brian Carey biscotty666 at gmail.com
Sun Oct 30 17:56:39 UTC 2022


Thinking it through though I think my solution is bad since it implies a 
dependency between the urls defined in the program and the location used 
in nginx, ie. they must match and the program cannot be proxied at an 
arbitrary location. So hopefully there is a better solution than the one 
I found. I hope I'm not asking too many questions.

On 10/30/22 11:41, Brian Carey wrote:
>
> Okay I seem to have solved this. I re-wrote the app urls to mount all 
> directories under /striker, something unnecessary for the app itself 
> but necessary for nginx to properly forward. I also removed the 
> rewrite rule below.
>
> Thanks by the way for the help you give here.
>
> Brian
>
> On 10/30/22 11:20, Brian Carey wrote:
>>
>> Hi,
>>
>> I have an app running at port 8239 on biscotty.me. If I access the 
>> app directly everything works as expected.
>>
>> I am able to use proxy_pass to forward https:/biscotty.me/striker to 
>> the main page of my app. The problem is that all of the links in the 
>> app result in a page not found error from the apache server handling 
>> requests to /. So it seems like the port number information is 
>> somehow being lost in translation?
>>
>> This is my conf:
>>
>> ```
>>
>> location /striker {
>>                rewrite /striker/(.*) /$1 break;
>>                proxy_pass http://192.168.0.238:8239;
>>
>> proxy_set_header X-Real-IP $remote_addr;
>>                proxy_set_header X-Forwarded-For $remote_addr;
>>                proxy_set_header Host $host:8239;
>>
>>        }
>>
>>        location / {
>>                proxy_pass http://192.168.0.238:8080/;
>>                proxy_buffering on;
>>                proxy_buffers 12 12k;
>>                proxy_redirect off;
>>
>>                proxy_set_header X-Real-IP $remote_addr;
>>                proxy_set_header X-Forwarded-For $remote_addr;
>>                proxy_set_header Host $host:8080;
>>
>>        }
>>
>> ```
>>
>>
>> ```
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20221030/2d5dd3c3/attachment.htm>


More information about the nginx mailing list