Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic URL #4394

Closed
muh-ramadhan opened this issue Mar 7, 2021 · 7 comments
Closed

Dynamic URL #4394

muh-ramadhan opened this issue Mar 7, 2021 · 7 comments

Comments

@muh-ramadhan
Copy link

Can I add dynamic url to minimize configuration.

@MGatner
Copy link
Member

MGatner commented Mar 7, 2021

Read the User Guide on Routing: https://codeigniter.com/user_guide/incoming/routing.html

If you need more assistance, support questions need to be directed to the CodeIgniter Forums. GitHub is for bug reports and discussed feature requests.

@MGatner MGatner closed this as completed Mar 7, 2021
@muh-ramadhan
Copy link
Author

thanks sir, I mean can I add dynamic url function. in public $ baseURL and add a few lines in the Constants.php file

@muh-ramadhan
Copy link
Author

whether these changes are allowed, if I change the line public $baseURL = 'http://localhost:8080/'; become public $baseURL = 'DYNAMIC_BASE_URL';
then add the line DYNAMIC_BASE_URL to app\Config\Constans.php

@iRedds
Copy link
Collaborator

iRedds commented Mar 7, 2021

curl -H "HOST: Ass On Fire" http://target
Have fun.

@lonnieezell
Copy link
Member

To make the base URL dynamic in the main framework is to introduce a security risk, since as @iRedds pointed out it can be set as anything by the end user. That's why it's done the way it's done currently. Obviously, you're free to make your own decisions on your application and the situation it will be used, but unless for a very specific reason I wouldn't suggest it just to make your life simpler. If you do need that, make sure you have whitelist in place to check them against. Besides - using the .env file to set your baseUrl is pretty similar to what you're asking for.

@muh-ramadhan
Copy link
Author

thank you sir, what you have conveyed is input for me.

@mridah
Copy link

mridah commented May 8, 2021

@muh-ramadhan Were you able to use dynamic baseURLs ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants