Thanks for reply. It's working with 301.
But is there any way without using redirecting ? In my case, the spec URL will be integrate with other tools, 301 may cause unexpected error.
Maybe there is a function could generate current pr object's openapi spec contents, then I can just response it ?