I am changing the domain name of my app from old.com to new.com
My app is connected to external APIs that send data through webhooks, and I would like to redirect the webhooks sent to the old url, so that they hit the new url and get processed.
I have a tried a plain rewrite
server {
server_name old.com;
listen 443 ssl;
rewrite ^ https://new.com$request_uri;
I can see this triggers a 302 redirection, but that doesn't seem to do the trick..
I tried with a proxy_pass
server {
server_name old.com;
listen 443 ssl;
location /webHook {
proxy_pass https://new.com/webHook;
}
rewrite ^ https://new.com$request_uri;
Same result.. I can see a 302 redirect in the logs, but the webhook never seem to hit the new URL and doesn't get processed..
Any idea on how to achieve that?
The
rewrite
directives in theserver
block, which are not inside alocation
block are executed first (cf. ng_http_rewrite_module documentation).So delete or comment the
rewrite
directive and theproxy_pass
directive will get executed.Since the webhooks are not going to get a redirect (and thus, the only way for them to absorb your new app's domain is by your manual changes), why miss a trivial solution?
Simply add
old.com
underserver
where you havenew.com
: