Hello,
I have five questions.
Question number zero is - how can auto redirect HTTP to HTTPS when someone goes to http://myportal. ?
The other 4 questions are about the dev portal life cycle.
I seems that there are three versions: DEV, TEST and PROD.
I work on the DEV version and almost have it ready at http://dev-freightosdp.devportal.apigee.io
What happens when it's ready? Would it be:
This is the first question.
The second question is how do I promote DEV to TEST and TEST to PROD?
The third question is should we CNAME the API domain - any reason not to do it?
The fourth question is can I then continue to work on DEV version and rest assured that TEST and PROD aren't changing until I release the DEV?
Solved! Go to Solution.
@Anton+Bar , Find answers below.
How can auto redirect HTTP to HTTPS when someone goes to http://myportal. ?
if (isset($_SERVER['PANTHEON_ENVIRONMENT']) && php_sapi_name() != 'cli') { // Redirect to https://$primary_domain in the Live environment if ($_ENV['PANTHEON_ENVIRONMENT'] === 'live') { /** Replace www.example.com with your registered domain name */ $primary_domain = 'www.example.com'; } else { // Redirect to HTTPS on every Pantheon environment. $primary_domain = $_SERVER['HTTP_HOST']; } if ($_SERVER['HTTP_HOST'] != $primary_domain || !isset($_SERVER['HTTP_X_SSL']) || $_SERVER['HTTP_X_SSL'] != 'ON' ) { # Name transaction "redirect" in New Relic for improved reporting (optional) if (extension_loaded('newrelic')) { newrelic_name_transaction("redirect"); } header('HTTP/1.0 301 Moved Permanently'); header('Location: https://'. $primary_domain . $_SERVER['REQUEST_URI']); exit(); } }
Regarding migrating changes between environments,
The third question is should we CNAME the API domain - any reason not to do it?
The fourth question is can I then continue to work on DEV version and rest assured that TEST and PROD aren't changing until I release the DEV?
Hope it helps. Keep us posted if you see any issues while setting up same.
I already found how to promote to Test and Live but it's not clear to me - should we CNAME it on our end or use Pantheon to do it. Pantheon documentation is written as though we're running our main site on their system, but we're not. We just want to cname developer.freightos.com to live-freightosdp.devportal.apigee.io.
@Anton+Bar , Find answers below.
How can auto redirect HTTP to HTTPS when someone goes to http://myportal. ?
if (isset($_SERVER['PANTHEON_ENVIRONMENT']) && php_sapi_name() != 'cli') { // Redirect to https://$primary_domain in the Live environment if ($_ENV['PANTHEON_ENVIRONMENT'] === 'live') { /** Replace www.example.com with your registered domain name */ $primary_domain = 'www.example.com'; } else { // Redirect to HTTPS on every Pantheon environment. $primary_domain = $_SERVER['HTTP_HOST']; } if ($_SERVER['HTTP_HOST'] != $primary_domain || !isset($_SERVER['HTTP_X_SSL']) || $_SERVER['HTTP_X_SSL'] != 'ON' ) { # Name transaction "redirect" in New Relic for improved reporting (optional) if (extension_loaded('newrelic')) { newrelic_name_transaction("redirect"); } header('HTTP/1.0 301 Moved Permanently'); header('Location: https://'. $primary_domain . $_SERVER['REQUEST_URI']); exit(); } }
Regarding migrating changes between environments,
The third question is should we CNAME the API domain - any reason not to do it?
The fourth question is can I then continue to work on DEV version and rest assured that TEST and PROD aren't changing until I release the DEV?
Hope it helps. Keep us posted if you see any issues while setting up same.
@Anil Sagar - Re the CNAME - should we CNAME It in our own DNS provider or just can add developer.freightos.com under the Pantheon manager?
@Anton+Bar , You need to add developer.freightos.com under pantheon live instance domains settings as explained here & then update CNAME in your DNS provider. You can find the CNAME details in domain name details button in Pantheon. See screenshots below.
https://pantheon.io/docs/godaddy/
Hope it helps. Keep us posted.
@Anton+Bar , Feel free to accept the answer if your query is resolved so that it will be helpful for others too.
Keep us posted moving forward if any.
sorry was abroad, thanks for all the very valuable help!
User | Count |
---|---|
3 | |
2 | |
1 | |
1 | |
1 |