I somehow wanted the one I made myself. It is an implementation method at once.
First, before the development environment, prepare an environment where you can connect to the client → local server with a subdomain!
C:\Windows\System32\drivers\etc\hosts Edit Let's add "api.localhost".
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
127.0.0.1 api.localhost
# ::1 localhost
Allows Tomcat to accept access on subdomains.
In C: \ Program Files \ Apache Software Foundation \ Tomcat 8.5 \ conf \ server.xml Let's add a host for the subdomain.
server.xml
<Host name="api.localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
This time, the API is delivered by the same application as the web application, so appBase is the default webapps.
Now you are ready for delivery. From now on, I will actually write the Java code.
I created an api domain with Spring Framework. Part 2
Recommended Posts