Class FrontendProxyController
java.lang.Object
edu.ucsb.cs156.dining.controllers.FrontendProxyController
The FrontendProxyController is used to proxy requests to the frontend of the application.
This is only used in development where we have a separate frontend server process
listening on port 3000.
For production, see the FrontendController.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity
<?> proxy
(org.springframework.cloud.gateway.mvc.ProxyExchange<byte[]> proxy) This method proxies requests to the frontend server.
-
Constructor Details
-
FrontendProxyController
public FrontendProxyController()
-
-
Method Details
-
proxy
@GetMapping({"/","/{path:^(?!api|oauth2|swagger-ui|h2-console).*}/**"}) public org.springframework.http.ResponseEntity<?> proxy(org.springframework.cloud.gateway.mvc.ProxyExchange<byte[]> proxy) This method proxies requests to the frontend server. It is only used in development. The regular expression is used to exclude the paths that should NOT be proxied to the frontend server, such as the endpoints for the api, oauth2, and swagger-ui.- Parameters:
proxy
- the proxy exchange, injected by Spring automatically- Returns:
- response entity with the response from the frontend server, or a response entity with instructions in case the frontend server cannot be reached.
-