question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JHipster behind reverse proxy

See original GitHub issue
Overview of the issue

The UI doesn’t display anything when it’s loaded behind a reverse proxy on my remote server (no other port than port 80 opened so I use a proxy_pass with nginx). It’s perfectly reachable but it seems that webpack-angular 2 has some trouble with the path http://my-domain/my-path

vendor.dll.js Failed to load resource: the server responded with a status of 404 (Not Found) c9977571b3904794d148.manifest.bundle.js Failed to load resource: the server responded with a status of 404 (Not Found) c9977571b3904794d148.global.bundle.js Failed to load resource: the server responded with a status of 404 (Not Found) c9977571b3904794d148.main.bundle.js Failed to load resource: the server responded with a status of 404 (Not Found) c9977571b3904794d148.polyfills.bundle.js Failed to load resource: the server responded with a status of 404 (Not Found) c9977571b3904794d148.main.bundle.js Failed to load resource: the server responded with a status of 404 (Not Found) c9977571b3904794d148.global.bundle.js Failed to load resource: the server responded with a status of 404 (Not Found)

Motivation for or Use Case

This is a recurrent problem I encounter every time I run it behind a reverse proxy. Unfortunately, I couldn’t find any solution or documentation on the topic.

It seems that the /*.bundle.js are retrieved from http://my-domain/*.bundle.js instead of http://my-domain/my-path/*.bundle.js

Reproduce the error

Just add a: location /my-path/ { proxy_pass: localhost:port; } in the nginx configuration file (here using Ubuntu 16.04 )

Related issues

No solution or similar issue found; no documentation at all.

Suggest a Fix

My current investigation lead me to webpack.dev.js where there might be configurations for the proxy though I couldn’t point the real issue or the configuration to make.

JHipster Version(s)

JHipster Generator v4.1.1

JHipster configuration

{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "*",
      "nativeLanguage": "en"
    },
    "jhipsterVersion": "4.1.1",
    "baseName": "*",
    "packageName": "*",
    "packageFolder": "*",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "hibernateCache": "no",
    "clusteredHttpSession": false,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "mysql",
    "searchEngine": "elasticsearch",
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSocialSignIn": false,
    "jwtSecretKey": "*",
    "clientFramework": "angular2",
    "useSass": false,
    "clientPackageManager": "yarn",
    "applicationType": "monolith",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": [
      "en",
      "zh-tw",
      "nl",
      "fr",
      "ko",
      "mr"
    ]
  }
}
Entity configuration(s) entityName.json files generated in the .jhipster directory

The problem is not related to any entity

Browsers and Operating System
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
git version 2.7.4
node: v7.8.0
npm: 4.4.4
bower: 1.8.0
gulp:
[11:12:52] CLI version 3.9.1
yeoman: 1.8.5
yarn: 0.21.3
Docker version 17.03.1-ce, build c6d412e
docker-compose version 1.11.2, build dfed245
  • Checking this box is mandatory (this is just to show you read everything)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
pascalgrimaudcommented, Apr 21, 2017

@ruddell : using ./ instead of / in the index.html seems to be the right solution. I’ve just made some very very fast tests and it works. But there are some error logs in browser when I navigate in different page:

  • change in index.html: ./
  • add in spring boot config: server.contextPath: /toto
  • go to http://localhost:8080/toto

For me, there is maybe a change to do in index.html and some documentation about it. Thanks @ruddell and don’t worry it’s not urgent 😃

0reactions
ruddellcommented, Apr 21, 2017

@pascalgrimaud Maybe changing it to ./ would pick up the correct base when it is not /? I’m not sure if it even works for this issue but I think I remember helping someone with this when deploying to a Tomcat context path.

I’m traveling this weekend so I don’t have time to test right now

Read more comments on GitHub >

github_iconTop Results From Across the Web

jHipster dev profile reverse proxy? - Stack Overflow
Now I'm trying to run the dev profile and it hosts it on localhost:8080, which is fine. But I want to proxy it...
Read more >
Separating the front-end and the API server - JHipster
CORS (Cross-origin request sharing) allow to access different back-end servers with the same front-end, without configuring a proxy. This is an easy-to-use ...
Read more >
jhipster/generator-jhipster - Gitter
i was able to set up a reverse proxy from an nginx server to a separate tomcat server on the /stage path but...
Read more >
Nginx Reverse Proxy | Jimmy sees the IT world - jimmysyss
I am playing around JHipster recently, one of the goal for it is the Micro services architecture. Under such assumption, a reverse proxy...
Read more >
How to deploy Angular and Spring Boot apps behind Nginx ...
NGINX is a free, open-source, high-performance HTTP server and reverses proxy, as well as an IMAP/POP3 proxy server. NGINX is known for its...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found