Giter Club home page Giter Club logo

Comments (2)

yaweiw avatar yaweiw commented on May 26, 2024

it now only works with "docker compose up" demo.

from azure-spring-cloud-playground.

sophiaso avatar sophiaso commented on May 26, 2024

Possible solutions:

  1. Use system properties in the generated cloud gateway index page to dynamically generate urls.
  • add environment variable to the dockerfile and docker-compose
  • use Spring thymeleaf template to write index page
  • ref to the system properties in the front index page with ${@environment.getProperty('GATEWAY_URL')}
  • Add Spring thymeleaf to the dependency and thymeleaf configuration in the template
  • add environment variable to the start script and readme etc about how to configure and run the downloaded Spring Cloud project
  1. Rewrite the gateway home page links with javascript.
  • gateway index page Spring Cloud modules href with port and subpath only,
    e.g., <a href=":8888/abc">ABC</href>
  • when page is firstly loaded, rewrite the href by adding the protocol and hostname to the href, e.g.,
<html>
<head>
<script>
function setHref() {
document.getElementById('modify-me').href = window.location.protocol + "//" + window.location.hostname + ":8080/other/";
}
</script>
</head>

<body onload="setHref()">
<a href="/other/" id="modify-me">Look at another port</a>
</body>
</html>

to e.g.,:
<a href="https://my.deployed.host:8888/abc">ABC</href>

Pros and Cons:

  1. Solution 1 is a little complex, many configurations and instructions for the user

  2. Solution 2 is easy to implement, but it relies on each Spring Cloud Microservices are deployed to the same host with different ports(azure web app only exposes 443 and 80 port, which makes it impossible to deploy to multiple ports), or at least the deployed hostnames share predefined rules, e.g., share same prefix or suffix.

e.g., home page with ABC.com
       eureka page with ABC.eureka.com
       hystrix page with ABC.hystrix.com

from azure-spring-cloud-playground.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.