nginx proxy: forward port 8080 to 80 works but generated links in webapp don't work after that The Next CEO of Stack OverflowProxy HTTPS requests to a HTTP backend with NGINXnginx redirect issue with upstream configurationNginx proxy pass works for https but not httpnginx load balancer rewrite to listen portnginx proxy redirecting request to different proxyNginx subversion commit failureNginx/Apache: set HSTS only if X-Forwarded-Proto is httpsnginx reverse proxy hide login query also on 301 redirect or full qualified urlSingle server for multiple web-apps (same domain)Nginx reverse proxy to many local servers + webserver duty

How to invert MapIndexed on a ragged structure? How to construct a tree from rules?

Does soap repel water?

Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?

How to install OpenCV on Raspbian Stretch?

How to scale a tikZ image which is within a figure environment

Tactics for judging if a printed image will be bright enough?

Is there always a complete, orthogonal set of unitary matrices?

Is there a difference between "Fahrstuhl" and "Aufzug"

Why the difference in type-inference over the as-pattern in two similar function definitions?

WOW air has ceased operation, can I get my tickets refunded?

Which one is the true statement?

What did we know about the Kessel run before the prequels?

Domestic-to-international connection at Orlando (MCO)

I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin

Plot of histogram similar to output from @risk

Why does standard notation not preserve intervals (visually)

Prepend last line of stdin to entire stdin

How do I align (1) and (2)?

Method for adding error messages to a dictionary given a key

What is the value of α and β in a triangle?

How a 64-bit process virtual address space is divided in Linux?

Can a Bladesinger Wizard use Bladesong with a Hand Crossbow?

Do I need to write [sic] when a number is less than 10 but isn't written out?

Is it my responsibility to learn a new technology in my own time my employer wants to implement?



nginx proxy: forward port 8080 to 80 works but generated links in webapp don't work after that



The Next CEO of Stack OverflowProxy HTTPS requests to a HTTP backend with NGINXnginx redirect issue with upstream configurationNginx proxy pass works for https but not httpnginx load balancer rewrite to listen portnginx proxy redirecting request to different proxyNginx subversion commit failureNginx/Apache: set HSTS only if X-Forwarded-Proto is httpsnginx reverse proxy hide login query also on 301 redirect or full qualified urlSingle server for multiple web-apps (same domain)Nginx reverse proxy to many local servers + webserver duty










0















I'm trying to setup up a really simple thing:



use Nginx to listen to port 8080 and forward everything to internal host with port 80.
This is my config so far:



server 
listen 8080;
server_name publichost;

location /
proxy_set_header Host $http_host;
proxy_pass http://app1;


server
listen 80;
server_name publichost;

location /
proxy_set_header Host $http_host;
proxy_pass http://app2;




So far so good. Now when I open http://publichost:8080 it works and the browser shows the index.html site.



But now, every resource link in this index.html try to load files from app2



<link rel="stylesheet" type="text/css" href="http://publichost/static/styles.css">


this totally makes sense, since the proxy forwards every requests with port 8080 to my app1 and uses internal port 80, and every request with port 80 goes to app2.



My question is: How can I configure nginx proxy, so that it just works?
I want to be able to have another webapplication that is reachable via default port 80.










share|improve this question
























  • Use proxy_redirect, e.g. proxy_redirect http://localhost:8080 http://app2; and don't forget your trailing slashes in proxy_pass (I think you need them in your config)

    – Lenniey
    yesterday












  • proxy_redirect only rewrites response headers, it does not touch the response body. The proper fix is to fix the misbehaving web application.

    – Michael Hampton
    yesterday











  • You can use sub_filter to modify the response body, but it's not a scalable solution.

    – Richard Smith
    yesterday















0















I'm trying to setup up a really simple thing:



use Nginx to listen to port 8080 and forward everything to internal host with port 80.
This is my config so far:



server 
listen 8080;
server_name publichost;

location /
proxy_set_header Host $http_host;
proxy_pass http://app1;


server
listen 80;
server_name publichost;

location /
proxy_set_header Host $http_host;
proxy_pass http://app2;




So far so good. Now when I open http://publichost:8080 it works and the browser shows the index.html site.



But now, every resource link in this index.html try to load files from app2



<link rel="stylesheet" type="text/css" href="http://publichost/static/styles.css">


this totally makes sense, since the proxy forwards every requests with port 8080 to my app1 and uses internal port 80, and every request with port 80 goes to app2.



My question is: How can I configure nginx proxy, so that it just works?
I want to be able to have another webapplication that is reachable via default port 80.










share|improve this question
























  • Use proxy_redirect, e.g. proxy_redirect http://localhost:8080 http://app2; and don't forget your trailing slashes in proxy_pass (I think you need them in your config)

    – Lenniey
    yesterday












  • proxy_redirect only rewrites response headers, it does not touch the response body. The proper fix is to fix the misbehaving web application.

    – Michael Hampton
    yesterday











  • You can use sub_filter to modify the response body, but it's not a scalable solution.

    – Richard Smith
    yesterday













0












0








0








I'm trying to setup up a really simple thing:



use Nginx to listen to port 8080 and forward everything to internal host with port 80.
This is my config so far:



server 
listen 8080;
server_name publichost;

location /
proxy_set_header Host $http_host;
proxy_pass http://app1;


server
listen 80;
server_name publichost;

location /
proxy_set_header Host $http_host;
proxy_pass http://app2;




So far so good. Now when I open http://publichost:8080 it works and the browser shows the index.html site.



But now, every resource link in this index.html try to load files from app2



<link rel="stylesheet" type="text/css" href="http://publichost/static/styles.css">


this totally makes sense, since the proxy forwards every requests with port 8080 to my app1 and uses internal port 80, and every request with port 80 goes to app2.



My question is: How can I configure nginx proxy, so that it just works?
I want to be able to have another webapplication that is reachable via default port 80.










share|improve this question
















I'm trying to setup up a really simple thing:



use Nginx to listen to port 8080 and forward everything to internal host with port 80.
This is my config so far:



server 
listen 8080;
server_name publichost;

location /
proxy_set_header Host $http_host;
proxy_pass http://app1;


server
listen 80;
server_name publichost;

location /
proxy_set_header Host $http_host;
proxy_pass http://app2;




So far so good. Now when I open http://publichost:8080 it works and the browser shows the index.html site.



But now, every resource link in this index.html try to load files from app2



<link rel="stylesheet" type="text/css" href="http://publichost/static/styles.css">


this totally makes sense, since the proxy forwards every requests with port 8080 to my app1 and uses internal port 80, and every request with port 80 goes to app2.



My question is: How can I configure nginx proxy, so that it just works?
I want to be able to have another webapplication that is reachable via default port 80.







nginx proxy docker






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 4 hours ago







artgrohe

















asked yesterday









artgroheartgrohe

1368




1368












  • Use proxy_redirect, e.g. proxy_redirect http://localhost:8080 http://app2; and don't forget your trailing slashes in proxy_pass (I think you need them in your config)

    – Lenniey
    yesterday












  • proxy_redirect only rewrites response headers, it does not touch the response body. The proper fix is to fix the misbehaving web application.

    – Michael Hampton
    yesterday











  • You can use sub_filter to modify the response body, but it's not a scalable solution.

    – Richard Smith
    yesterday

















  • Use proxy_redirect, e.g. proxy_redirect http://localhost:8080 http://app2; and don't forget your trailing slashes in proxy_pass (I think you need them in your config)

    – Lenniey
    yesterday












  • proxy_redirect only rewrites response headers, it does not touch the response body. The proper fix is to fix the misbehaving web application.

    – Michael Hampton
    yesterday











  • You can use sub_filter to modify the response body, but it's not a scalable solution.

    – Richard Smith
    yesterday
















Use proxy_redirect, e.g. proxy_redirect http://localhost:8080 http://app2; and don't forget your trailing slashes in proxy_pass (I think you need them in your config)

– Lenniey
yesterday






Use proxy_redirect, e.g. proxy_redirect http://localhost:8080 http://app2; and don't forget your trailing slashes in proxy_pass (I think you need them in your config)

– Lenniey
yesterday














proxy_redirect only rewrites response headers, it does not touch the response body. The proper fix is to fix the misbehaving web application.

– Michael Hampton
yesterday





proxy_redirect only rewrites response headers, it does not touch the response body. The proper fix is to fix the misbehaving web application.

– Michael Hampton
yesterday













You can use sub_filter to modify the response body, but it's not a scalable solution.

– Richard Smith
yesterday





You can use sub_filter to modify the response body, but it's not a scalable solution.

– Richard Smith
yesterday










0






active

oldest

votes












Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f960608%2fnginx-proxy-forward-port-8080-to-80-works-but-generated-links-in-webapp-dont-w%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Server Fault!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f960608%2fnginx-proxy-forward-port-8080-to-80-works-but-generated-links-in-webapp-dont-w%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

Esgonzo ibérico Índice Descrición Distribución Hábitat Ameazas Notas Véxase tamén "Acerca dos nomes dos anfibios e réptiles galegos""Chalcides bedriagai"Chalcides bedriagai en Carrascal, L. M. Salvador, A. (Eds). Enciclopedia virtual de los vertebrados españoles. Museo Nacional de Ciencias Naturales, Madrid. España.Fotos