erip
(Elijah Rippeth)
1
I have a service with a descriptor like this:
private val uuidRegex =
"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
final override def descriptor: Descriptor = {
import Service._
named("foo")
.withCalls(...)
.withAcls(
ServiceAcl(pathRegex = Some(s"/api/foos/$uuidRegex/upload"))
)
.withAutoAcl(autoAcl = true)
}
I find that any of the calls defined in withCalls
are routed correctly through the service gateway and are servicable through port 9000.
The upload call, on the other hand, is not. I must explicitly make the call to the FooService instead of the gateway.
Is it possible to route all traffic through the gateway?
ignasi35
(Ignasi Marimon-Clos)
2
1 Like
erip
(Elijah Rippeth)
3
Seems very sensible. :-) I’ll let you know tomorrow how it goes.
Edit
It seems like this doesn’t work. To make it closer to my real example…
final override def descriptor: Descriptor = {
import Service._
named("foo")
.withCalls(
restCall(
Method.POST,
"/api/foo/:fooId/uploads/:uploadId/update",
updateFoo _
),
restCall(
Method.GET,
"/api/foos/:fooId/uploads/:uploadId",
getUploadInfo _
)
)
.withAcls(
// Corresponds to update
ServiceAcl(pathRegex = Some(s"/api/foos/$uuidRegex/uploads/$uuidRegex/update")),
// Corresponds to get
ServiceAcl(pathRegex = Some(s"/api/foos/$uuidRegex/uploads/$uuidRegex")),
// Corresponds to an upload -- just like the file upload recipe
ServiceAcl(pathRegex = Some(s"/api/foos/$uuidRegex/submissions"))
)
}
When I submit a request, I get the following (truncated) HTML response:
<pre><span class="line">2</span><span class="route"><span class="verb">*</span><span class="path">/api/foos/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/uploads/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/update</span><span class="call">Service: foo (http://0.0.0.0:54671)</span></span></pre>
<pre><span class="line">3</span><span class="route"><span class="verb">*</span><span class="path">/api/foos/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/uploads/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$</span><span class="call">Service: foo (http://0.0.0.0:54671)</span></span></pre>
<pre><span class="line">4</span><span class="route"><span class="verb">*</span><span class="path">/api/foos/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/uploads</span><span class="call">Service: foo (http://0.0.0.0:54671)</span></span></pre>
Edit 2
It was the anchors on the regex! When I removed them and the withAutoAcl
, it works fine! You were right, @ignasi35.